Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Error on Autofill

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Error on Autofill

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Error on Autofill

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 1004 - Autofill diepvic Excel Programming 3 June 30th 09 08:49 AM
Autofill & On Error Resume Next Dandelo Excel Discussion (Misc queries) 2 August 21st 08 07:14 PM
AutoFill Funtion Error DM Excel Programming 3 October 24th 05 01:17 AM
Autofill Error Edgar Thoemmes[_4_] Excel Programming 2 January 13th 05 02:46 AM
autofill macro has error when there is nothing to fill. RichardO[_9_] Excel Programming 2 June 9th 04 05:31 AM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"