Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default AutoFill difficulty

I'm getting an Error 1004 on the highlighted line of the following code.

With ActiveSheet
.Range("DG5").Select
numberofRows = ActiveCell.CurrentRegion.Rows.Count

.Range("DG5").Value = "=VLOOKUP($DH5,$N$3:$AP$9000,29,TRUE)"
Set SourceRange = .Range("DH5")
Set fillRange = .Range(Cells(6, 111), Cells((numberofRows - 5), 111))
SourceRange.AutoFill Destination:=fillRange
End With

Could you please help me with this? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default AutoFill difficulty

The highlighting doesn't show. But are you trying to put a formula in DG5 and
copy it down? If so, you should use the Formula property, not Value, i.e.

.Range("DG5").Formula = "=VLOOKUP($DH5,$N$3:$AP$9000,29,TRUE)"

In case it's the AutoFill command that's the problem, if you look at Help for
AutoFill, you'll see the following:

"Destination Required Range object. The cells to be filled. The destination
must include the source range."

You are violating that rule.


On Wed, 10 Nov 2004 19:36:00 GMT, "Jim Berglund" wrote:

I'm getting an Error 1004 on the highlighted line of the following code.

With ActiveSheet
.Range("DG5").Select
numberofRows = ActiveCell.CurrentRegion.Rows.Count

.Range("DG5").Value = "=VLOOKUP($DH5,$N$3:$AP$9000,29,TRUE)"
Set SourceRange = .Range("DH5")
Set fillRange = .Range(Cells(6, 111), Cells((numberofRows - 5), 111))
SourceRange.AutoFill Destination:=fillRange
End With

Could you please help me with this? Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default AutoFill difficulty

PS: If the purpose is to copy the formula down, you probably want the FillDown
method, not AutoFill. Again, look at Help for FillDown if you need it.


On Wed, 10 Nov 2004 19:36:00 GMT, "Jim Berglund" wrote:

I'm getting an Error 1004 on the highlighted line of the following code.

With ActiveSheet
.Range("DG5").Select
numberofRows = ActiveCell.CurrentRegion.Rows.Count

.Range("DG5").Value = "=VLOOKUP($DH5,$N$3:$AP$9000,29,TRUE)"
Set SourceRange = .Range("DH5")
Set fillRange = .Range(Cells(6, 111), Cells((numberofRows - 5), 111))
SourceRange.AutoFill Destination:=fillRange
End With

Could you please help me with this? Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default AutoFill difficulty

Thanks, Myrna. It works, now.

I think the 'help' for AutoFill messed me up. I copied the example - and
didn't know what else to do when it didn't work...

Jim

"Myrna Larson" wrote in message
...
PS: If the purpose is to copy the formula down, you probably want the
FillDown
method, not AutoFill. Again, look at Help for FillDown if you need it.


On Wed, 10 Nov 2004 19:36:00 GMT, "Jim Berglund"
wrote:

I'm getting an Error 1004 on the highlighted line of the following code.

With ActiveSheet
.Range("DG5").Select
numberofRows = ActiveCell.CurrentRegion.Rows.Count

.Range("DG5").Value = "=VLOOKUP($DH5,$N$3:$AP$9000,29,TRUE)"
Set SourceRange = .Range("DH5")
Set fillRange = .Range(Cells(6, 111), Cells((numberofRows - 5), 111))
SourceRange.AutoFill Destination:=fillRange
End With

Could you please help me with this? Thanks




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
Function Difficulty Johnnie[_2_] Excel Discussion (Misc queries) 5 October 20th 08 09:54 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
IF Statement difficulty susan hayes Excel Worksheet Functions 3 November 2nd 04 09:46 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
difficulty with logical - if - and billabong Excel Programming 5 September 20th 03 10:55 PM


All times are GMT +1. The time now is 10:11 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"