View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bruce Erlichman[_2_] Bruce Erlichman[_2_] is offline
external usenet poster
 
Posts: 1
Default Macro bug - looping thru multiple worksheets - workaround?

You were right – the MS work-around worked,
as follows:

Sub Test1()
Dim x As Object
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
For Each x In ActiveWindow.SelectedSheets
ActiveCell.FormulaR1C1 = "=(RC[-4]+RC[-3])"
Range("G2").Select
Next x
End Sub

But this didn’t:

Sub Test1()
Dim x As Object
Sheets(Array("Sheet1",
"Sheet2",
"Sheet3")).Select
For Each x In ActiveWindow.SelectedSheets
ActiveCell.FormulaR1C1 = "=(RC[-4]+RC[-3])"
Range("G2").Select
Next x
End Sub


The reason for listing the sheets in a vertical
fashion is because the actual problem involves
several hundred sheets and wrap-around was cumber-
some.

Any way to reference these sheets in a global
manner, without listing each and every one,
like "Sheet1-Sheet3"?


Much thanks for your time.


Bruce Erlichman



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!