Filter show all in VBA

M

Mia

Hi I using filtering in VBA programming and I have a problem when I want to
show all in a column. Do any one know the code and what I should write? I
have tryed with folliwing but it dosent work. All filtering works but not to
show all (alla means all).

Private Sub Worksheet_Change(ByVal Target As Range)
'
ActiveSheet.Unprotect

Dim Fakturerad As String
Fakturerad = ActiveSheet.Range("C11")

ActiveSheet.ListObjects("Tabell102713").Range.AutoFilter


ActiveSheet.ListObjects("Tabell102713").Range.AutoFilter Field:=11,
Criteria1 _
:=Fakturerad

If c11 = "Alla" Then
ActiveSheet.ListObjects("Tabell102713").Range.AutoFilter Field:=11,
Criteria1 _
:="<>"
End If
End Sub
 
M

Mia

Hell and thank yoy for your help!

It dosen´t work. Instead of showing all its showing nothing.

BR
Mia


"Jacob Skaria" skrev:
 
M

Mia

It should be Hello and thank you, not hell!!!!
I'm so sorry!!!!! I am very grateful for all help!

Mia


"Mia" skrev:
 
M

Mia

Hello again,

You were totaly right! I changed C11 to Fakturerad and now i works!
Thank you for your help!


BR
Mia

Private Sub Worksheet_Change(ByVal Target As Range)
'
ActiveSheet.Unprotect

Dim Fakturerad As String
Fakturerad = ActiveSheet.Range("C11")

ActiveSheet.ListObjects("Tabell102713").Range.AutoFilter


ActiveSheet.ListObjects("Tabell102713").Range.AutoFilter Field:=11,
Criteria1 _
:=Fakturerad

If Fakturerad = "Alla" Then
ActiveSheet.ListObjects("Tabell102713").Range.AutoFilter Field:=11
End If
End Sub


--
Best regards
Mia


"Jacob Skaria" skrev:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top