Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried to use two nested DO While loops still would fail.
Then there was the following: For i = 1 To 11 Worksheets("PReport " & i).Range("J14:K28").ClearContents Next I'm back in business, Thanks for your help. I got where I was going but still would be nice to know why I couldn't go the way I wanted to. -- Jim at Eagle "Jim at Eagle" wrote: 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub mersion()
Dim i As Integer For i = 1 To 31 Worksheets(i).Activate ActiveSheet.Range("J14:K28").ClearContents Next End Sub -- Gary''s Student - gsnu200778 "Jim at Eagle" wrote: 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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Works fine for me - are you sure you have 32 sheets in your workbook?
"Jim at Eagle" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
(Complex) Loop within loop to create worksheets | Excel Programming | |||
Loop Through worksheets | Excel Programming | |||
Loop worksheets | Excel Programming |