I have a workbook that refreshes data connections, then filters dates from yesterday. When there is only one row that is refreshed, I will get a
Run time error 1004.
Some days the macro works, some days it doesn't. This is run daily.
Sub Get_VRIDs()    
    Dim i As Integer
    Sheets("Cancels").Select
    i = 1
    With Range("E2")
    If .Cells(1, 1).Value = "" Then
    Else
    Range(.Cells(1, 1), .End(xlDown)).Copy 
    Destination:=Sheets("Metric").Range("a6")
     x = x + 1
    End If
    End With
    Sheets("Adhoc").Select
    i = 1
With Range("C2")
   If .Cells(1, 1).Value = "" Then
   Else
     Range(.Cells(1, 1), .End(xlDown)).Copy Destination:=Sheets("Metric").Range("a94")
     x = x + 1
   End If
End With
Sheets("Direct Tender").Select
i = 1
    With Range("B2")
   If .Cells(1, 1).Value = "" Then
   Else
     Range(.Cells(1, 1), .End(xlDown)).Copy Destination:=Sheets("Metric").Range("a132")
     x = x + 1
  Sheets("Metric").Activate
   End If
End With
Sheet1.Activate
    Range("B6").Select
    Selection.Copy
    Range("A6:A90").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWindow.SmallScroll Down:=48
    Range("B60").Select
    Selection.Copy
    Range("A94:A128").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWindow.SmallScroll Down:=24
    Range("B90").Select
    Selection.Copy
    Range("A132:A200").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWindow.SmallScroll Down:=-108
    Range("A7").Select
    Call Hide_Rows
End Sub
The error occurs at this line:
  Range(.Cells(1, 1), .End(xlDown)).Copy Destination:=Sheets("Metric").Range("a94")
 
    