Hi,#
Could someone tell me why this isn't working? I can get it to work for non-dates (obviously changing the column in the autofilter to one that accepts the relevant values), but dates are proving a problem!
Many thanks,
James.
Could someone tell me why this isn't working? I can get it to work for non-dates (obviously changing the column in the autofilter to one that accepts the relevant values), but dates are proving a problem!
Code:
Sub AM()
Dim Root As String
Dim DteAry() As Date
Dim n As Long
Sheets("Parameters").Select
Window = Cells(2, 1)
Root = Cells(1, 1)
Dim numcounts As Integer
numcounts = Application.WorksheetFunction.CountA(Range("A4:A1048576"))
For Each iCell In Range(Cells(4, 3), Cells(6, 3))
If iCell.Value <> " " Then
n = n + 1
ReDim Preserve DteAry(1 To n)
DteAry(n) = iCell.Value
End If
Next iCell
For i = 1 To numcounts
Sheets("Parameters").Select
web = Cells(i + 3, 1)
Workbooks.Open Filename:= _
Root & web & ".xlsx"
Range("A2:J2").Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$J$5000").AutoFilter Criteria1:=DteAry, Field:=2, Operator:=xlFilterValues
End sub
Many thanks,
James.