I’ve a msgBox in place to handle a given scenario (it does that)
Unsurprising it is also gets triggered when I MANUALLY clear the range it refers to.
But is there any way to suppress it ONLY when/if I manually clear the range?
Please bear in mind this is very much a work in progress!!
For clarity the "FLtrRng" is the dynamic range that will be filtered and Range("BRangeToFilter").AutoFilter is the NAMED first cell of the filter range.
Unsurprising it is also gets triggered when I MANUALLY clear the range it refers to.
But is there any way to suppress it ONLY when/if I manually clear the range?
Please bear in mind this is very much a work in progress!!
For clarity the "FLtrRng" is the dynamic range that will be filtered and Range("BRangeToFilter").AutoFilter is the NAMED first cell of the filter range.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sht As Worksheet
Dim rng As Range
Dim FrwD As Long
Dim LrwD As Long
Dim FLtrRng As Range
Set sht = ThisWorkbook.ActiveSheet
Set rng = sht.Range("T:T").Find(what:="Cash Paid", LookIn:=xlValues, LookAt:=xlWhole)
FrwD = rng.Row + 2
LrwD = sht.Cells(sht.Rows.Count, "AT").End(xlUp).Row
'############################################################################
Debug.Print "rng:" & Range("T:T").Find(what:="Cash Paid", LookIn:=xlValues, LookAt:=xlWhole).Address
Debug.Print "rng: " & rng.Address
Debug.Print "rng.Row: " & rng.Row
Debug.Print "Target: " & Target.Address
Debug.Print LrwD.Address
Debug.Print "LrwD: " & LrwD.Address
Debug.Print "FLtrRng: " & Range("AQ" & FrwD & ":AT" & LrwD).Address
'#############################################################################'
'?????????? Want to suppress this MsgBox ONLY IF the FLtrRng is MANUALY cleared
Set FLtrRng = sht.Range("AQ" & FrwD & ":AT" & LrwD + 1)
If WorksheetFunction.CountA(FLtrRng) = 0 Then
MsgBox FLtrRng.Address(0, 0) & " NO Details in Filter Range"
Else
If Target.Address = Range("BLimitedFilterList").Address Then
If Range("BLimitedFilterList") = "All Details" Then
Range("BRangeToFilter").AutoFilter
Else
Range("BRangeToFilter").AutoFilter field:=3, Criteria1:=Range("BLimitedFilterList")
End If
End If
End If
End Sub