![]() |
Macro Problem
I am trying to build a macro to automate some of my worksheet filtering.
Here's what I have been trying to use: Sub StrikeCheck() For i = 3 To 3 Range("B" & i).Select Dim A As String A = "=" & Range("B" & i).Value Dim B As String B = "=" & Range("D" & i).Value Dim C As String C = "<=" & Range("E" & i).Value Dim D As String D = "=" & Range("F" & i).Value Dim E As String E = "=" & Range("G" & i).Value Sheets("configman").Select Selection.AutoFilter Field:=4, Criteria1:=A, Operator:=xlAnd Selection.AutoFilter Field:=6, Criteria1:=B, Operator:=xlAnd, _ Criteria2:=C Selection.AutoFilter Field:=5, Criteria1:=D, Operator:=xlAnd Next i End Sub The Macro does not preform the last Filter, For Criteria=D correctly. The values in theat column are dates. The value that is being put into the filter is a formated date and is a result of a formula. Are there some suggestions on how I can get this to work ? Thank you in advance. |
Macro Problem
Maybe use
D = "=" & format(Range("F" & i).Value,"mm/dd/yyyy") "carl" wrote: I am trying to build a macro to automate some of my worksheet filtering. Here's what I have been trying to use: Sub StrikeCheck() For i = 3 To 3 Range("B" & i).Select Dim A As String A = "=" & Range("B" & i).Value Dim B As String B = "=" & Range("D" & i).Value Dim C As String C = "<=" & Range("E" & i).Value Dim D As String D = "=" & Range("F" & i).Value Dim E As String E = "=" & Range("G" & i).Value Sheets("configman").Select Selection.AutoFilter Field:=4, Criteria1:=A, Operator:=xlAnd Selection.AutoFilter Field:=6, Criteria1:=B, Operator:=xlAnd, _ Criteria2:=C Selection.AutoFilter Field:=5, Criteria1:=D, Operator:=xlAnd Next i End Sub The Macro does not preform the last Filter, For Criteria=D correctly. The values in theat column are dates. The value that is being put into the filter is a formated date and is a result of a formula. Are there some suggestions on how I can get this to work ? Thank you in advance. |
All times are GMT +1. The time now is 01:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com