VBA to count sheets


Posted by Louise on June 14, 2000 2:08 AM

I've tried and failed on creating this Macro.

I would like someone to help me if at all possible.

I need VBA programme to do its business i.e. copying, pasting etc. But to only do it to the 1st 22 Sheets.
I will then extract those sheets and then get the VBA code to do the next 22 Sheets.

I've tried with arrays and the sheet names, but useless if names are not specified.

Is this easy or am I losing my marbles.

Please help.

Louise

Posted by Ryan on June 14, 0100 2:41 AM

Check out what I wrote for Donna. Her message was on 6/6. If that's not right, then post what exactly you will be doing.

Ryan

Posted by mads on June 14, 0100 3:04 AM


One way is to use a counter. For example :-

Sub DoIt22Times()
Dim count As Integer
count = 0
For Each Worksheet In Worksheets
Worksheet.Range("A1") = "Louise"
count = count + 1
If count = 22 Then Exit Sub
Next
End Sub

mads




Posted by Louise on June 14, 0100 5:07 AM

Thanks

Ta!

Thanks for your help.

Louise