T
Tommy N
Dim ws As Excel.Worksheet
Dim z As Excel.Range
Dim rs As New ADODB.Recordset
Dim rc As Integer
rs.Open "ModifiedData", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic, adCmdTable
rc = rs.RecordCount
rs.Close
Set rs = Nothing
Set C = Nothing
Set ws = wb.Worksheets("Pivot Data")
Set z = ws.Range("A2:R2")
z.Select
Selection.AutoFill Destination:=Range(Cells(2, 1), Cells(rc + 1, 18)),
Type:=xlFillDefault
Range("A1").Select
I am getting a 1004 error on this code on my second a subsequent attempts to
run this code. It runs the first time fine. Any ideas on what is wrong with
this code. the line of code that it is stopping on is the AutoFill line.
Dim z As Excel.Range
Dim rs As New ADODB.Recordset
Dim rc As Integer
rs.Open "ModifiedData", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic, adCmdTable
rc = rs.RecordCount
rs.Close
Set rs = Nothing
Set C = Nothing
Set ws = wb.Worksheets("Pivot Data")
Set z = ws.Range("A2:R2")
z.Select
Selection.AutoFill Destination:=Range(Cells(2, 1), Cells(rc + 1, 18)),
Type:=xlFillDefault
Range("A1").Select
I am getting a 1004 error on this code on my second a subsequent attempts to
run this code. It runs the first time fine. Any ideas on what is wrong with
this code. the line of code that it is stopping on is the AutoFill line.