Consulting

Results 1 to 3 of 3

Thread: Solved: Fill by number of rows

  1. #1

    Solved: Fill by number of rows

    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:
    [vba]
    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
    [/vba]

    Any help would be appreciated

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim numRecs As Integer

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

    Range("B1").Resize(numrecs).FormulaR1C1 = "xxxx" [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Perfect

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •