Question about my code for vba autofilter

dimitrisko

New Member
Joined
Aug 15, 2017
Messages
15
Code:
Sub Anazitisi_apodosi()


Sheets("ÐÑÏÃÑÁÌÌÁ").Range("AB15:AB1000").AutoFilter , Field:=28, Criteria1:=">Sheet2.Range('A7').Value", Operator:=xlAnd, Criteria2:=<sheet2.range('b7').value"

End Sub

I want to autofilter within a range of numbers that are stored in two cells. I Dont want to be always the same numbers that i write in vba. Is that possible?</sheet2.range('b7').value"
 
Last edited by a moderator:
The sheet name in your macro does not match the sheet name on the tab. I don't know if that's just down to language packs or not. But try
Code:
Sheet2.AutoFilterMode = False
Sheet2.Range("AB14:AB200").AutoFilter field:=1, Criteria1:=">=" & Sheet2.Range("A7").Value, Operator:=xlAnd, Criteria2:="<=" & Sheet2.Range("b7").Value
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
It works fine for me.
Click the filter > Number filters
There should be a tick against "Between" click that & what does it show?
 
Upvote 0
In that case I've no idea.
I've never come across that sort of behaviour.
 
Upvote 0
Do you know what else could work in my case? any alternative? All macros in my workbook work perfect i dont know why this dont
 
Upvote 0
Fraid not. Your code should work.
 
Upvote 0

Forum statistics

Threads
1,224,830
Messages
6,181,225
Members
453,025
Latest member
Hannah_Pham93

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top