PDA

View Full Version : Solved: Fill by number of rows



tkaplan
03-29-2011, 09:17 AM
I know this is an easy one, I just haven't been doing much of this recently and am drawing a blank.
In excel 2007:
Column A has a bunch of values, both numberic and text.
I am putting a formula in B2 that I want to autofill down till the last row that there is a value in column A.

so I'm trying to do:

Dim numRecs as Integer

numRecs = ' code for counting the values in column A minus 1

Range("B1").formulaR1C1 = "xxxx"
Selection.AutoFill Destination:=Range(activecell,activecell.offset(numRecs),0), Type:=xlFillDefault


Any help would be appreciated

Bob Phillips
03-29-2011, 10:08 AM
Dim numRecs As Integer

numRecs = Cells(Rows.Count, "B").End(xlUp).Row

Range("B1").Resize(numrecs).FormulaR1C1 = "xxxx"

tkaplan
03-29-2011, 12:14 PM
Perfect :)

Thanks!