Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() I am trying to write a macro which filters a table of data using criteria determined in another worksheet. This is the code that I produced to date. The variables Cruiseline1 and cruiseline2 work fine however I want to be able to filter a date range as well. I cannot get the greater than equals to command to work. Any suggestions? Dim Cruiseline1 Dim Cruiseline2 Dim Date1 Dim Date2 Cruiseline1 = Worksheets("Front Sheet").Range("b3").Value Cruiseline2 = Worksheets("Front Sheet").Range("b4").Value Date1 = Worksheets("Front Sheet").Range("c6").Value Date2 = Worksheets("Front Sheet").Range("c7").Value Selection.AutoFilter Field:=5, Criteria1:=Cruiseline1, _ Operator:=xlOr, Criteria2:=Cruiseline2 Selection.AutoFilter Field:=1, Criteria1:=Format(Date1, Selection.Cells(2, 1).NumberFormat), _ Operator:=xlAnd, Criteria2:<=Format(Date2, Selection.Cells(2, 1).NumberFormat) -- APealin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Control button / macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
autofilter macro | Excel Discussion (Misc queries) | |||
Keep autofilter after macro is run | Excel Worksheet Functions | |||
Autofilter Macro Help | Excel Discussion (Misc queries) |