Something very strange is going on.
I have a spreadsheet saved with an autofilter on.
I then call one method (via a button) which fills some data and does some filtering.
I then change one of the filtered (visible) cells from N to Y.
However, when I call the next method (via a second button) I get error 91 when trying to address the range
i.e.
Code:
Private Sub cmdDownload_Click()
Dim rngFilter As Range
Set rngFilter = Sheet14.AutoFilter.Range
gives
Code:
Object variable or With block variable not set
Also checking AutoFilterMode returns false
Code:
Private Sub cmdDownload_Click()
If AutoFilterMode = False Then
Sheet14.Range("B11").AutoFilter
End If
Dim rngFilter As Range
Set rngFilter = Sheet14.AutoFilter.Range
This then has the effect of REMOVING the autofilter that was previously on. (Because it thinks it is off when it isn't "Sheet14.Range("B11").AutoFilter" has the effect of turning it off instead of on)
If I put 2 such blocks, I end up with the AutoFilter displayed on screen.
However, I still get the error when I try to set my range.