loop through sheet 2 - sheet n


Posted by Rob on August 15, 2001 10:23 AM

I was wondering if anyone has any sample vb code on looping through sheet 2 - sheet n(skipping the first sheet).

Posted by neo on August 15, 2001 12:05 PM

what do you mean 'looping through sheet 2 - sheet n'? why are you looping through them (want functions are happening or what data are you looking for, etc)?

neo

Posted by rob on August 15, 2001 12:40 PM

i have controls on sheet 1. so i am trying to figure out how to start at sheet 2, perform some actions(eg:copy, paste,etc) then go to next sheet, perform some actions, etc. unitl the i have performed all desired actions on the sheets.
ex: for sheet(2) to sheet(5)
perform actions
next sheet


Posted by Robb on August 15, 2001 4:43 PM

Rob

Presuming you want to do something on all sheets except Sheet1, try this:

Sub NNN()
For Each s In ActiveWorkbook.Sheets
s.Activate
If ActiveSheet.Name <> "Sheet1" Then
{Your code}
Next s
End Sub

That work for you?




Posted by Rob W on August 16, 2001 12:32 PM

Sure did! Thanks. Im just learing macros so it was prob. a redundant or dumb question but I needed some help.

any chance you might have an example of how to find the last cell of say columns A-D that have data in them?

Rob Presuming you want to do something on all sheets except Sheet1, try this: Sub NNN()