Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to run the same code over a number of worksheets, and to this
end I've declared a static array as follows: Dim tmpBk As Workbook Dim wsArr(1 To 8) As String Dim wsName As String Dim tmpWs As Worksheet Dim tmpRng As Range Dim dataName As String Dim firstDay As Date firstDay = DateSerial(yr, mth, 1) dataName = DATAPATH & yr & "hi\" & Format(firstDay, "mmyy") & "hi.xls" Workbooks.Open dataName, 0, True wsArr = Array("Value1", "Value2", "Value3", "Value4", _ "Value5", "Value6", "Value7", "Value8") Set tmpBk = Workbooks.Open(HCMCPATH & "something.xls", 0) For Each wsName In wsArr Set tmpWs = tmpBk.Worksheets(wsName) [snip] Next wsName When I try to compile this I get the error "Can't assign to array". I know I could go through one by one and assign the values by saying wsArr(1) = Value1 for instance but I'd like to get them all done at once. Any suggestions? TIA -- There are 10 types of people in the world - those who understand binary and those who don't. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
assigning values to array | Excel Programming | |||
Assigning a value to an array cell | Excel Programming | |||
Assigning 10x1 array to 2nd collumn of 10x3 array | Excel Programming | |||
Assigning 10x1 array to 2nd collumn of 10x3 array | Excel Programming | |||
Assigning Array Values | Excel Programming |