G
Guest
What are some alternate ways of writing this...
maxDim =
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E2").Value + _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E3").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E4").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E5").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E6").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E7").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I2").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I3").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I4").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I5").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I6").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I7").Value
ReDim myArray(maxDim) As String
I tried to use the Union method but wasn't successful. But I am curious
about the alternate ways to write this. Less coding is prefered. But I'm
still interested in any way to write/accomplish this same thing.
Is there some sort of ... "x = Range("E2:E7,I2:I7").sum" VB statement that
would work?
maxDim =
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E2").Value + _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E3").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E4").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E5").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E6").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("E7").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I2").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I3").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I4").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I5").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I6").Value
+ _
Workbooks("AF-Scenario.xls").Worksheets("Settings").Range("I7").Value
ReDim myArray(maxDim) As String
I tried to use the Union method but wasn't successful. But I am curious
about the alternate ways to write this. Less coding is prefered. But I'm
still interested in any way to write/accomplish this same thing.
Is there some sort of ... "x = Range("E2:E7,I2:I7").sum" VB statement that
would work?