Autofilter-sorting from specified cell

M

Mia

Hello,

I´m trying to with autofilter, everything i working fine but I want to sort
after a specified cell, in this case D5. Do anyone know how to do this?



My code is:

Sub Januari()
'
' Sortera januari i betaltlistan Makro
'
'
ActiveSheet.Unprotect

ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter
ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=5,
Criteria1 _
:="$D5"

ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=32,
Criteria1 _
:="<>"

End Sub


Keep my fingers krossed.

BR
Mia
 
M

Mia

If someones intrested, I solved it myself. I used following code:

Sub Januari()
'
' Sortera januari i betaltlistan Makro
'
'
ActiveSheet.Unprotect

Dim val As String
val = ActiveSheet.Range("D5")


ActiveSheet.ListObjects("Tabell101226").Range.AutoFilter
ActiveSheet.ListObjects("Tabell101226").Range.AutoFilter Field:=5,
Criteria1 _
:=val


ActiveSheet.ListObjects("Tabell101226").Range.AutoFilter Field:=32,
Criteria1 _
:="<>"


End Sub




"Mia" 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