Excel 2007 VBA - looping through scenarios not possible?

  • Thread starter Thread starter Wim R.M. Dekeyser
  • Start date Start date
W

Wim R.M. Dekeyser

Hi,
I have a number of scenarios that I need to perform some calculations on.
I am trying to keep the code short by having a for - next loop running
through all the scenarios.

I am not having much luck getting that to work, though.
Shouldn't the following work?

For intLooping = 1 To 20
Scenarios(intLooping).Show
Next


The following, on the other hand, does work (but doesn't do any good).

For intScenNr = 1 To 20
arrScenarios(intScenNr - 1) = Scenarios(intScenNr).Name
Next
MsgBox Scenarios(1).Name & " - to - " & Scenarios(6).Name
MsgBox arrScenarios(0) & " - to - " & arrScenarios(5)

Thanks for any ideas!

cheers,
wim
 
sorry about that one.
It helps to turn off protection on the sheet first.

cheers,
wim
 
Back
Top