Autofilter table depending on the date value from different sheet MACRO VBA

mark692

Active Member
Joined
Feb 27, 2015
Messages
321
Office Version
  1. 2016
Platform
  1. Windows
Hi sir as the title say, i want to filter a table depending on the value form different sheet


i have 2 sheets

Sheet 1 is where the cell is located with a date (Example cell is B1)

on

Sheet 2 i have a table with a column "DATE", i want to filter the column DATE, depending on the given date on sheet 1 B1


im using this code but i think its not working

ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:= range. B1

thanks in advance :)
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
How about
Code:
ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:=Sheets("Sheet1").Range("B1")
 
Upvote 0
How about
Code:
ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:=Sheets("Sheet1").Range("B1")


thank you sir for your reply but the column that filtered is not showing any result,
 
Upvote 0
i see, if the format is date, its not working but if i change the format to a value, it works, its not working if the criteria is on date format, :(
 
Upvote 0
If you are filtering on dates try
Code:
ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:=CDate(Sheets("Sheet1").Range("B1"))
or
Code:
ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:=Clng(Sheets("Sheet1").Range("B1"))
 
Upvote 0
If you are filtering on dates try
Code:
ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:=CDate(Sheets("Sheet1").Range("B1"))
or
Code:
ActiveSheet.ListObjects("Table8").Range.AutoFilter Field:=1, Criteria1:=Clng(Sheets("Sheet1").Range("B1"))


hi sir it gives me error invalid procedure call or argument
 
Upvote 0
There is no reason why you would get that error on that line, if the code in post#2 did not give an error.
 
Upvote 0
There is no reason why you would get that error on that line, if the code in post#2 did not give an error.


i get it now sir the error "invalid procedure call or argument" only appears when i use it on my laptop, but when im on my desktop computer, it works fine. thats weird :LOL:
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

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