Rash983
asked on
VBA macro to run the sensitivity analysis report
I've been trying to write a macro to run the sensitivity analysis report by clicking a command button instead of going to data> solver> solve> sensitivity report> ok (worksheet "optimize" ). I created a similar command button to run solver but I need another button to get the sensitivity report. Could you please help me with that? please find attached Excel file.
VBA.xlsx
VBA.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Which line gives that error?
ASKER
This line >>>> Sheets(strName).Activate
End Sub
End Sub
I don't use those versions of Excel but for that line try either
Worksheets((strName).Activ ate
or
Worksheets((strName).Selec t
Or you could just comment out lines 10 to 18. The report will still be created but you won't taken to the resulting sheet.
In any case I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
Worksheets((strName).Activ
or
Worksheets((strName).Selec
Or you could just comment out lines 10 to 18. The report will still be created but you won't taken to the resulting sheet.
In any case I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
I just had another (and probably better) thought. In Excel Excel 97-2003, does the Sensitivity reports still start with the word "Sensitivity"? Line 12 expects that it does and if not strName will never get a value and you;ll get the "subscript out of range" error.
ASKER
Thank you very much for your help. Yes, it does but with the this issue the Sensitivity report is never generated.
ASKER
Can I email you the file to look at the problem closely?
You can send me an EE Message and attach the file.
ASKER