'ThisWorkbook' Macro Question
Alright you guys are really going to have to humor me here because I'm
new to this... But by using Bob's example here's what I came up with:
(don't laugh)
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim R As Integer
R = 3
For Each sh In Thisworkbook.Worksheets
If sh.name < "SUMMARY" Then
Do Until R = Cells(Rows.Count, 9).End(xlUp).Row
Select Case Cells(R, 9)
Case "X"
Cells(R, 10) = "Data1"
Cells(R, 11) = "1"
Case "Y"
Cells(R, 10) = "Data2"
Cells(R, 11) = "2"
Case "Z"
Cells(R, 10) = "Data3"
Cells(R, 11) = "3"
End Select
R = R + 1
Loop
End If
Next sh
End Sub
Basically I'm trying to populate values into Sheets 2-5 columns 10 and
11 by using the criteria specified in the Case statements and the code
above isnt working (for obvious reasons I'm sure).
Thanks,
-- Dan
John Bundy wrote:
Using the sheet index you can, this excludes the first page and provides a
sample.
For i = 2 To Worksheets.Count
Sheets(i).Cells(1, 1) = "hi"
Next
--
--
-John
Please rate when your question is answered to help us and others know what
is helpful.
"Dan R." wrote in message
oups.com...
I have a macro that I want to run on all sheets except the first one.
Can I just put all the code in 'ThisWorkbook' and somehow tell it to
exclude the first sheet?
Thanks,
Dan
|