ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping (https://www.excelbanter.com/excel-programming/318781-looping.html)

Gusset Gadder

Looping
 
How do I perform the same set of command/functions on every worksheet in the
workbook without having to specify the worksheet names.
Must also work if I add or remove a sheet.

Thank you



Ron de Bruin

Looping
 
Hi Gusset

Dim sh as Worksheet
For Each sh In ThisWorkbook.Worksheets
'your code
Next sh

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gusset Gadder" wrote in message ...
How do I perform the same set of command/functions on every worksheet in the
workbook without having to specify the worksheet names.
Must also work if I add or remove a sheet.

Thank you





Gusset Gadder

Looping
 

"Ron de Bruin" wrote in message
...
Hi Gusset

Dim sh as Worksheet
For Each sh In ThisWorkbook.Worksheets
'your code
Next sh



Brilliant !!

Thank you so much




All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com