Consulting

Results 1 to 3 of 3

Thread: Solved: Copying formula down used range

  1. #1
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location

    Solved: Copying formula down used range

    I’ve got a sheet that will have a lot of values in Columns A:V. The Rows are variable, sometimes may have 20 rows, sometimes 100. Columns W:Z have formulae that I need dragged down to calculate the used range of rows.

    I have a formula but it only does it for 1 additional row, I’m not sure how to adjust it.
    Please advise.
    Thanks

    [VBA]
    Dim NextRw as long
    NextRw = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
    Range(.Cells(NextRw, 23), .Cells(NextRw, 26)).FormulaR1C1 = _
    Range(.Cells(2, 23), .Cells(2, 26)).FormulaR1C1

    [/VBA]

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

    Sub AddFormulae()
    Dim Lastrow As Long

    With ActiveSheet

    Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
    .Range("W2:Z2").AutoFill .Range("W2:Z2").Resize(Lastrow - 1)
    End With
    End Sub
    [/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
    VBAX Tutor
    Joined
    Mar 2009
    Posts
    227
    Location
    Thanks xld........works as required!

Posting Permissions

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