Originally Posted by
wilg
Well I'm not sure on how to put this in somewhere else. I tried a module, but it didn't regognize "me" for the tabs when I tried calling it from a worksheet_calculate event.
If you mean a Standard Module, the reason is that Me is a special keyword used to refer to the object that the class module refers to. Its not too hard to have the basics if you just remember this: Me in a Userform refers to the UserForm, Me in a worksheet refers to the worksheet. Its like ThisWorkbook refers to the workbook that the code is housed in. The difference is that Me can only be used in the class/object module.
Originally Posted by
wilg
In only 3 sheets out of the 223 tabs I need a differnt code for worksheet_calculate.
one important thing to note is I have the workbook on manual calculate because one tab compiles a huge amount of info and slows down the workbook. Each tab only calculates if active.
Paul's suggestion I am having a had time manipulating to my specific code.
Any other suggestion is much appreciated.
Okay, a quick stab, and not tested. In a junk copyof your wb, put this in the ThisWorkbook Module:
Option Explicit
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Select Case Sh.Name
Case "Sheet1", "Sheet2", "Sheet3" '<--Change to the sheetnames you do NOT want the code to run against.//
Case Else
With Sh
If .Range("as1") = "n" Then
.Tab.ColorIndex = 3 ' RED
.Move After:=Sheets(Sheets.Count)
ThisWorkbook.Sheets("2 STATUS").Select
Else
If .Range("as5") > 7 Then
.Tab.ColorIndex = 5 ' BLUE
Else
If .Range("as5") > 1 And .Range("AS5") < 7 Then
If .Range("as2") <> "Informed" Then
MsgBox .Range("AS1").Value & vbNewLine & vbNewLine & " IS PAST THEIR ANNIVERSARY DATE." & vbNewLine & vbNewLine & "PLEASE PRINT OUT ATTENDANCE AND CLEAR CELLS TO START A NEW YEAR.", vbInformation, "AD.A.M. ASSISTANCE."
.Tab.ColorIndex = 6 ' yellow
.Move before:=Sheets("1 maint")
.Range("as2").FormulaR1C1 = "Informed"
Else
If .Range("as5") > 1 And .Range("AS5") < 7 Then
.Tab.ColorIndex = 6
.Move before:=Sheets("1 maint")
End If
End If
End If
End If
End If
End With
End Select
End Sub
Again, not tested or proofed, I just copied your code.
Hope that helps,
Mark