ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loop through a certain group of worksheets only (https://www.excelbanter.com/excel-programming/333371-loop-through-certain-group-worksheets-only.html)

Chris M

loop through a certain group of worksheets only
 
Hello all,

In a workbook with several worksheets, I need to adjust something in any
worksheet with a name beginning with "Day" (ie, process all worksheets like
"Day 1", "Day 2", etc.) I will not know how many "day" sheets there are.
Also, the file name will always be different.

What would be a simpler/effective loop that I could use for this and other
similar files?

Thanks!!
--
Chris M

keepITcool

loop through a certain group of worksheets only
 

dim wks as worksheet
dim wkb as workbook

set wkb = activeworkbook 'workbooks("name")/thisworkbook
for each wks in wkb.worksheets
if lcase(wks.name) like "day*" then
'do stuf
end if
next


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Chris M wrote :

Hello all,

In a workbook with several worksheets, I need to adjust something in
any worksheet with a name beginning with "Day" (ie, process all
worksheets like "Day 1", "Day 2", etc.) I will not know how many
"day" sheets there are. Also, the file name will always be different.

What would be a simpler/effective loop that I could use for this and
other similar files?

Thanks!!



All times are GMT +1. The time now is 08:53 AM.

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