View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Naveen Naveen is offline
external usenet poster
 
Posts: 100
Default Run time error '9'

Try this ...

===========================================
Sub Naveen()
Dim lastrow As Long
lastrow = ActiveCell.SpecialCells(xlLastCell).Row
Range("G2:I2").AutoFill Destination:=Range("G2:I" & lastrow)
End Sub
===========================================

*** Please do rate ***





"BEEJAY" wrote:

The following gives this error, with "subscript out of range" message
When I select debug, it hi-lites the 3rd line.
As far as I can see, this process is a direct copy from elsewhere in this ng.
what am I missing?

' Copy formulas in G2 and I2 down thru to last used Row

Dim lastrow As Long
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Range("G2").AutoFill Destination:=Range("G3:G" & lastrow)

lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Range("I2").AutoFill Destination:=Range("I3:I" & lastrow)

Thanks in advance.