View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim at Eagle Jim at Eagle is offline
external usenet poster
 
Posts: 83
Default Loop thru worksheets(i)

Thanks for your help.
I get a runtime error 9 subscript out of range
there were two other suggestions to my request that when limited to sheets
22-32 i would get same error.
When allowing i to start at 1 it would happly work trashing a few extra
sheets.
Any suggestions?
excel 2003 xppro and there are more then 32 sheets.

--
Jim at Eagle


"Don Guillett" wrote:

Sub clearsheets()
For i = 22 To 31 ' Sheets.Count
Sheets(i).Range("j14:k28").ClearContents
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jim at Eagle" wrote in message
...
Dim i As Byte
i = 22
Do While i < 32
Worksheets(i).Range("J14:K28").ClearContents
i = i + 1
Loop

I have tried many ways but allways get one of several errors when the
worksheet line is run. Any help here will be greatly appreciated.
--
Jim at Eagle