简体   繁体   中英

Excel multiple goal seek macro code error

I am using a simple macro found in internet for Multiple Goal Sheek in Excel 2010. The link is here

The point is that the macro is working in the example test MultipleGoalSeek(KB19).xls . given in that link.

But when I try to apply it in my excel sheet, it only solves the first Goal Sheek problem, leaving the others un-calculated. I have no idea why although the macro seems pretty easy (maybe because they are not integers?)

I attach my excel problem with the macro.

Thank you

Hmmm .... this is a very early piece of brettdj code, it dates back to my beginner days a decade or so ago. And it shows .... !

The issue is in the third last row of the code, contrary to the instructons in the file, it was designed to work over columns only (I was running a time-based inventory adjustment at the time)

Change

For i = 1 To TargetVal.Columns.Count

to

For i = 1 To TargetVal.Cells.Count  

And it works fine on your sample

I will work on the orginal code to run with variant arrays.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM