VBA is not filtering date column based on cell valur from different sheet

amitkumarsharma

New Member
Joined
Aug 31, 2016
Messages
10
1- '.AutoFilter Field:=108, Criteria1:="<" & WS1.Parent.Sheets("Sheet1").Cells(7, 5).Text, Operator:=xlAnd
2- '.AutoFilter Field:=108, Criteria1:="<" & Format(WS1.Parent.Sheets("Sheet1").Cells(7, 5), "dd-mm-yyyy"), Operator:=xlAnd
3- '.AutoFilter Field:=108, Criteria1:="<" & Format(WS1.Parent.Sheets("Sheet1").Cells(7, 5).Value, "dd-mm-yyyy"), Operator:=xlAnd
4- '.AutoFilter Field:=108, Criteria1:="<" & CStr(WS1.Parent.Sheets("Sheet1").Cells(7, 5).Value), Operator:=xlAnd
5- .AutoFilter Field:=108, Criteria1:="<" & CStr(WS1.Parent.Sheets("Sheet1").Cells(7, 5).Text), Operator:=xlAnd

I tried above five method but nothing is working,
I am filtering field 108 and date I am taking from different workbook's Cell (7,5)
filter is getting applied and I can see the value also, but I am not getting correct filtered rows, all I am able to see only header nothing else, no any other visible row.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
This worked for me
This Worked
SelDate = Format(WS1.Parent.Sheets("Sheet1").Cells(7, 5).Value, "dd-mm-yyyy")
.AutoFilter Field:=108, Criteria1:="<" & CDbl(SelDate), Operator:=xlAnd
 
Upvote 0
Solution

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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