![]() |
All Worksheets
Hello,
I am trying to use code that will perform an action on every worksheet in an excel file. I have tried using: Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets '''''''''''''some action which will move around on the worksheet''''''''''''''''' Next wks I get an error when using this. Is there another method to go to each worksheet that is in the file and perform the same action. Thank You, |
All Worksheets
If you're selecting ranges on those worksheets, then you have to select that
sheet first. Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets wks.select '<-- added '''''''''''''some action which will move around on the worksheet''''' Next wks But you don't usually need to select a range to work on it. wks.select range("a1").select selection.clearcontents could be written as: wks.range("a1").clearcontents tjh wrote: Hello, I am trying to use code that will perform an action on every worksheet in an excel file. I have tried using: Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets '''''''''''''some action which will move around on the worksheet''''''''''''''''' Next wks I get an error when using this. Is there another method to go to each worksheet that is in the file and perform the same action. Thank You, -- Dave Peterson |
All times are GMT +1. The time now is 04:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com