Testing a sheet for a change since last accessed
Hi Breck,
For each sheet with detail try something like this:
Public blnChanged As Boolean
Public intShowRows As Integer
Private Sub Worksheet_Activate()
If blnChanged Then
MsgBox "There are new rows"
Application.ScreenUpdating = False
Range("AI1:AI262").AutoFilter Field:=1, Criteria1:="<" & CStr
(intShowRows)
Application.ScreenUpdating = True
blnChanged = False
Else
Application.ScreenUpdating = False
Range("AI1:AI262").AutoFilter Field:=1, Criteria1:="<0"
Application.ScreenUpdating = True
End If
End Sub
On the main sheet try:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$3" Then
Sheet2.blnChanged = True
Sheet2.intShowRows = Target.Value
End If
If Target.Address = "$B$4" Then
Sheet3.blnChanged = True
Sheet3.intShowRows = Target.Value
End If
' Continued for each detail sheet
End Sub
HTH,
Wouter
|