Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Autofill knowing row and column number
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autofill column from data (code) in column next to it | Excel Worksheet Functions | |||
Knowing the number | Excel Discussion (Misc queries) | |||
Automating to autofill column B based on column A entry | Excel Discussion (Misc queries) | |||
Autofill Column D based on input in Column C | Excel Discussion (Misc queries) | |||
Number of different items in an entire column without knowing if some of the cells are blank | Excel Programming |