Oct-15-2020, 03:50 PM
So what is the code supposed to be?
In this example eval_value() is hidden inside Check()
In this example eval_value() is hidden inside Check()
def Check(file_name, mh_criticalval): test_file=file_name def eval_value(excel_sht, excel_col, mh_value): if excel_sht.cell(row=i, column=excel_col)>mh_value: cell_b=excel_sht.cell(row=i, column=excel_col).value='OK' eval_value(sht, 9, mh_criticalval) Check('test.xlsm',1)In this example Check() and eval_value() are both visible to the module and Check() uses eval_value().
def Check(file_name, mh_criticalval): test_file=file_name eval_value(sht, 9, mh_criticalval) def eval_value(excel_sht, excel_col, mh_value): if excel_sht.cell(row=i, column=excel_col)>mh_value: cell_b=excel_sht.cell(row=i, column=excel_col).value='OK' Check('test.xlsm',1)In this example Check() and eval_value() are both visible to the module and are called separately.
def Check(file_name, mh_criticalval): test_file=file_name def eval_value(excel_sht, excel_col, mh_value): if excel_sht.cell(row=i, column=excel_col)>mh_value: cell_b=excel_sht.cell(row=i, column=excel_col).value='OK' eval_value(sht, 9, mh_criticalval) Check('test.xlsm',1)I'm pretty sure this last one is not what you want as it makes no sense. But none of the examples make much sense to me because I see no reason why file_name is passed to Check() and then isn't used for anything. What is the purpose of Check()? Did you cut out some code that opens a file and reads in a spreadsheet? If that is the case you will want to use the first example.