Consulting

Results 1 to 2 of 2

Thread: Macro Formula with dynamic ranges

  1. #1
    VBAX Regular
    Joined
    Sep 2016
    Posts
    7
    Location

    Macro Formula with dynamic ranges

    Hello all,

    I am trying to build a quick and easy macro that inserts a custom concatenate formula, then selects down to the last row (usually 3-7 rows). I have the correct formula, but just cant get the ranges to work. Some help would be greatly appreciated if this is possible!!

    ActiveCell.FormulaR1C1 = "=myconcatenate(R[7]C:R[1]C)"

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Sub Test()
    Dim c As Range, d As Range
    Set c = ActiveCell.Offset(1)
    Set d = c.End(xlDown)
    ActiveCell.Formula = "=myconcatenate(" & Range(c, d).Address(0, 0) & ")"
    End Sub
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Tags for this Thread

Posting Permissions

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