Vba question

AussieVic

Active Member
Joined
Jan 9, 2009
Messages
364
Hi, i am trying to add Autofiltermode =false to the below, but i dont know how, any takers?

If .Count = 1 Then Exit Sub

so

If.count =1 then remove autofilter then exit sub
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,784
Office Version
  1. 365
Platform
  1. Windows
Is this what you mean?
Code:
If .Count = 1 Then
    ActiveSheet.AutoFilterMode = False
    Exit Sub
End If
If you really want it on one line then
Code:
If .Count = 1 Then ActiveSheet.AutoFilterMode = False: Exit Sub
 
Last edited:

AussieVic

Active Member
Joined
Jan 9, 2009
Messages
364
Peter,that works, just wondering if there is a way to add a msgbox which tells the user "No Data in Col I before the exit sub?

Is this what you mean?
Code:
If .Count = 1 Then
    ActiveSheet.AutoFilterMode = False
    Exit Sub
End If
If you really want it on one line then
Code:
If .Count = 1 Then ActiveSheet.AutoFilterMode = False: Exit Sub
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
2,555
Code:
If .Count = 1 Then
    ActiveSheet.AutoFilterMode = False
    msgbox("No Data in Col I")
    Exit Sub
End If
 

Watch MrExcel Video

Forum statistics

Threads
1,112,814
Messages
5,542,643
Members
410,565
Latest member
sebby_joe
Top