Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With Worksheets("Data")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row .Range("J3:T3").AutoFill Destination:=.Range("J7:T" & LastRow) _ , Type:=xlFillDefault End With I'm receiving Run-time error '1004' AutoFill method of Range class failed This works perfectly fine on another worksheet and different range. TIA Gerry |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Wally,
You are missing the dot in front of Rows.Count in the line assigning the row number to LastRow. However, and I think the main problem is that the AutoFill Destination range should start at J3 not J7. With Worksheets("Data") LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row .Range("J3:T3").AutoFill Destination:= _ .Range("J3:T" & LastRow), Type:=xlFillDefault End With Note that the missing dot in front of rows.count will not normally affect the outcome when getting the total rows in a worksheet but if you were using assigned ranges then it will and it is good practice to get into the habit of using it and ensure that it is referencing the With reference. -- Regards, OssieMac "Wally" wrote: With Worksheets("Data") LastRow = .Cells(Rows.Count, "A").End(xlUp).Row .Range("J3:T3").AutoFill Destination:=.Range("J7:T" & LastRow) _ , Type:=xlFillDefault End With I'm receiving Run-time error '1004' AutoFill method of Range class failed This works perfectly fine on another worksheet and different range. TIA Gerry . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just an afterthought Wally,
If you do want the destination to commence at cell J7 then I think that you will have to use copy and paste. -- Regards, OssieMac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error 1004 - Autofill | Excel Programming | |||
Autofill & On Error Resume Next | Excel Discussion (Misc queries) | |||
AutoFill Funtion Error | Excel Programming | |||
Autofill Error | Excel Programming | |||
autofill macro has error when there is nothing to fill. | Excel Programming |