View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Using Autofill knowing row and column number

Sub AA()
Dim NextRow As Long
Dim rng As Range
NextRow = 10
With ActiveSheet
Set rng = .Range(.Cells(NextRow - 1, 2), .Cells(NextRow, 2))
.Cells(NextRow - 1, 2).AutoFill Destination:=rng
End With
End Sub

--
Regards,
Tom Ogilvy




"Fred Smith" wrote in message
...
I want to do the programmatic equivalent of dragging the fill handle down
one row. I know the row and column number of the destination cell. I

tried:

.cells(Nextrow - 1, 2).autofill destination=.cells(Nextrow, 2)

but I got a range error. What's the correct syntax? Also, what's the

syntax
if I want to fill a range of cells (eg, columns 12 to17)?

--
Thanks,
Fred