Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each Next
I'm feeling like a dummy at the moment. I'm using the For Each statement
to cycle through all sheets in the activeworkbook, and perform actions. However, I have not used them befoer, and need help. This is what I have: Dim wksht As Worksheet Application.ScreenUpdating = False For Each wksht In ActiveWorkbook 'code to perform actions Next wksht But I get the error, "Object doesn't support this property or method". Help! Thanks. *** Sent via Developersdex http://www.developersdex.com *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each Next
"Darrin Henshaw" wrote in message
... I'm feeling like a dummy at the moment. I'm using the For Each statement to cycle through all sheets in the activeworkbook, and perform actions. However, I have not used them befoer, and need help. This is what I have: Dim wksht As Worksheet Application.ScreenUpdating = False For Each wksht In ActiveWorkbook 'code to perform actions Next wksht But I get the error, "Object doesn't support this property or method". Help! Thanks. Does this help? For Each wksht in ActiveWorkbook.Worksheets ' insert your code here next wksht |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each Next
At least I don't get the error now. But what does happen is that the
actions I need to perform are only happening in the activeworksheet, not any of the others. Here's an update to the code: Dim wksht As Worksheet Application.ScreenUpdating = False For Each wksht In ActiveWorkbook.Worksheets Point to note, this same thing happens if I use Sheets, instead of the ActiveWorkbook. Thanks. *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each Next
Are you performing those actions on the wksht object? i.e. wksht.cells or
wksheet.range, etc.? "Darrin Henshaw" wrote: At least I don't get the error now. But what does happen is that the actions I need to perform are only happening in the activeworksheet, not any of the others. Here's an update to the code: Dim wksht As Worksheet Application.ScreenUpdating = False For Each wksht In ActiveWorkbook.Worksheets Point to note, this same thing happens if I use Sheets, instead of the ActiveWorkbook. Thanks. *** Sent via Developersdex http://www.developersdex.com *** |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each Next
I guess the actions are on the wksht.Cells object, since I'm inserting a
set number of rows. *** Sent via Developersdex http://www.developersdex.com *** |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each Next
this should do it
Sub insertrowsinallsheets() For Each w In Worksheets w.Cells(1, 1).Resize(3, 1).EntireRow.Insert Next End Sub -- Don Guillett SalesAid Software "Darrin Henshaw" wrote in message ... I guess the actions are on the wksht.Cells object, since I'm inserting a set number of rows. *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|