Good Afternoon,

I have this macro query that works fine for 99% of the time (query results are defined by user date input), but for some reason it doesn't like certain dates (seems to be ones after 20th of a month).

E.g., when I enter in today's date I get the 'Run-time error '1004' - Autofill method of range class failed'. The macro is listed below, with the line in question in bold and italicized. Any suggestions, comments or solutions would be greatly appreciated. Thanks!!!


Private Sub btnRefresh_Click()

Sheets("Data").Range("A1").QueryTable.Refresh BackgroundQuery:=False
Sheets("CustodyHoldings").Range("A1").QueryTable.Refresh BackgroundQuery:=False
Sheets("Summary").PivotTables("PivotTable1").PivotCache.Refresh

Dim intCount As Integer
intCount = 8

Do Until IsEmpty(Sheets("Summary").Range("A" & CStr(intCount))) = True
intCount = intCount + 1
Loop

Columns("E:G").ClearContents
Range("G8").FormulaR1C1 = "Do We Hold?"
Range("E9").FormulaR1C1 = _
"=VLOOKUP(RC[-4],CustodyHoldings!R[-7]C[-4]:R[9992]C[-4],1,FALSE)"
Range("F9").FormulaR1C1 = "=ISERROR(RC[-1])"
Range("G9").FormulaR1C1 = "=IF(RC[-1],""No"",""Yes"")"
Range("E9:G9").Select
Selection.AutoFill Destination:=Range("E9:G" & CStr(intCount - 2)), Type:=xlFillDefault

Sheets("Summary").Range("A3").Select

End Sub