Need to bring Cell value into autofilter VBA

LeonardH

New Member
Joined
Dec 21, 2013
Messages
33
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

I have the following code currently:

VBA Code:
ActiveSheet.ListObjects("Table4").Range.AutoFilter Field:=33, Criteria1:= _
        "<7/1/2020"
    ActiveSheet.ListObjects("Table4").Range.AutoFilter Field:=35, Criteria1:= _
        "<1/01/1900"
      
    Range("D6:E3743").SpecialCells(12).Select
        Selection.Copy
    Sheets("Explanations").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False


While the "<1/01/1900" makes sense since that is just calling out 0's, I need to make the "<7/1/2020" based off the date value in cell A5 of sheet "Explanations" and still keep the criteria <. Does anyone have any ideas?

Thanks!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You might want to add some error checking to ensure A5 only contains a valid date field.
VBA Code:
ActiveSheet.ListObjects("Table4").Range.AutoFilter Field:=33, _
    Criteria1:="<" & Worksheets("Explanations").Range("A5").Value, Operator:=xlAnd
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,853
Members
449,194
Latest member
HellScout

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