View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Using Autofill knowing row and column number

How about:

Option Explicit
Sub testme01()
Dim NextRow As Long
NextRow = 3 'test data only
With ActiveSheet
.Cells(NextRow - 1, 2).AutoFill _
Destination:=.Cells(NextRow - 1, 2).Resize(2, 1)
End With
End Sub



Fred Smith wrote:

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


--

Dave Peterson