LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
DM DM is offline
external usenet poster
 
Posts: 2
Default AutoFill Funtion Error

I'm not an experienced VBA programmer and need someone's help. The code
below comes from a recorded macro, with some ideas from the VBA help files,
and I've attempted to modify it to be more generic and not associated with a
specific row or sheet.

After modifying a cell's formula to reflect a new sheet name, I'm attempting
to copy it across several columns, as follows (newRow is Dim'ed as an
integer and is valid when I run the code):

newFormula = "='" & sheetName & "'!K$2"
Cells(newRow, 4).formula = newFormula
ActiveSheet.Cells(newRow, 4).Select
Selection.AutoFill Destination:=Range(Cells(newRow, 5), Cells(newRow,
9)), Type:=xlFillDefault

I get a run-time error 1004 - Autofill method of Range class failed. If I
debug the code and hover the cursor over the various elements, I get
"Cells(newRow, 5)=Error 2023".

What am I doing incorrectly and where can I find the definitions of the
reported error codes? I've searched help and searched the MS website
without success.

TIA

DJM


 
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
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 10 April 16th 09 09:06 PM
Autofill & On Error Resume Next Dandelo Excel Discussion (Misc queries) 2 August 21st 08 07:14 PM
Date Value Funtion in Excel 2003 returns an error, but not in Exce olearyd Excel Worksheet Functions 1 April 13th 05 04:59 PM
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 09:32 AM.

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"