View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Another Simple Error - More Info

Jim,

The fill range must include the source range, so the following works...
'---------------------------------------
Sub FillTest()
Dim SourceRange As Excel.Range
Dim FillRange As Excel.Range
Dim i As Long
i = 10
Set SourceRange = Worksheets("Power Units").Range("A3:AV3")
Set FillRange = Worksheets("Power Units").Range(Cells(3, 1), Cells(i, 48))
SourceRange.AutoFill Destination:=FillRange
End Sub
'---------------------------------------
Regards,
Jim Cone
San Francisco, USA


"Jim Berglund" wrote in message news:5n5Qd.388476$Xk.289660@pd7tw3no...
I also tried...
Set SourceRange = Worksheets("Power Units").Range("A3:AV3")
Set fillRange = Worksheets("Power Units").Range(Cells(4, 1), Cells(i, 48))
SourceRange.AutoFill Destination:=fillRange
With an error in the middle line. Apparently I'm having problems using a variable in the Range.
Jim