Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro with the following statement:
Selection.AutoFilter Field:=1, Criteria1:="=5/15/2006", Operator:=xlAnd _ , Criteria2:="<=5/28/2006" I want to replace the two dates with references to the values in cells B1 and B2 in the sheet "Macro Data". How do I do this? Dan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dan, you can play with this: (values in A1 & A2)
Selection.AutoFilter Field:=1, Criteria1:="=" & Cells(1, 1), Operator:=xlAnd _ , Criteria2:="<=" & Cells(2, 1) jr "Dan" wrote: I have a macro with the following statement: Selection.AutoFilter Field:=1, Criteria1:="=5/15/2006", Operator:=xlAnd _ , Criteria2:="<=5/28/2006" I want to replace the two dates with references to the values in cells B1 and B2 in the sheet "Macro Data". How do I do this? Dan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
JR,
Thank you for your reply. I have a date in both B1 and B2 (sheet "Macro Data"). In my macro, I have the following code: Dim EndDate As Date Dim StartDate As Date StartDate = Sheets("Macro Data").Cells("B1") EndDate = Sheets("Macro Data").Cells("B2") Then I am going to use StartDate and EndDate in the AutoFilter statement that I gave in my previous message. However, the above statements are giving me error 13 (type mismatch). Can you help me with what's wrong with what I'm doing? Thanks! Dan "JR in NC" wrote: Dan, you can play with this: (values in A1 & A2) Selection.AutoFilter Field:=1, Criteria1:="=" & Cells(1, 1), Operator:=xlAnd _ , Criteria2:="<=" & Cells(2, 1) jr "Dan" wrote: I have a macro with the following statement: Selection.AutoFilter Field:=1, Criteria1:="=5/15/2006", Operator:=xlAnd _ , Criteria2:="<=5/28/2006" I want to replace the two dates with references to the values in cells B1 and B2 in the sheet "Macro Data". How do I do this? Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 macros set relative cell references | Excel Discussion (Misc queries) | |||
cell references in macros | Excel Discussion (Misc queries) | |||
Relative (vs. Absolute) Cell References with macros | Excel Discussion (Misc queries) | |||
Using cell references in Excel Macros | Excel Programming | |||
Relative Cell References in Macros | Excel Programming |