> > You need a little more code added:
>
[quoted text clipped - 72 lines]
>
> - Show quoted text -
This is the full text of the code of the original code I forgot to
include th sheetchange event.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Sh.Type = -4167 Then
Application.EnableEvents = False
Sh.Range("B1:C1").Value = Date & " " & Time
Application.EnableEvents = True
End If
End Sub
JLGWhiz - 28 Mar 2008 15:41 GMT
The worksheet change event will trigger the code in that specific worksheet.
For the code to apply to other sheets, the code must specifically state the
sheet, the range and the action to be taken. When you used the statement "If
ActiveSheet.Name = "Unit Status" Then", it does nothing because you have not
shifted focus to that sheet, so the condition will always be False. In other
words the ActiveSheet is the sheet the Worksheet_Change event is in. When
using the For Each sh In ActiveWorkbook.Sheets statement, the code tells VBA
to check each sheet and if the name matches, then do something. If the name
does not match, it should do nothing.
For more explanation, see "Looping Through a Range of Cells" in VBA help
files.
> > > You need a little more code added:
> >
[quoted text clipped - 83 lines]
> End If
> End Sub