+ Reply to Thread
Results 1 to 3 of 3

VBA Dynamic Range Auto-fill Series

  1. #1
    Registered User
    Join Date
    08-11-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    6

    VBA Dynamic Range Auto-fill Series

    Hi,

    I am new t VBA.

    I have the below VBA code where a new column is inserted, an identifier number is added and the series is filled till the last value in the adjoining column. What do I do to make the range dynamic?

    Columns("A:A").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Unique ID"
    Range("B1").Select
    Selection.Copy
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "5454000"
    Range("A2").Select
    Selection.AutoFill Destination:=Range("A2:A40721"), Type:=xlFillSeries
    Range("A2:A40721").Select

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: VBA Dynamic Range Auto-fill Series

    Count the rows,
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-11-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: VBA Dynamic Range Auto-fill Series

    Thank you soo much. Works perfectly!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Auto Fill base on a dynamic range
    By alexduy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2014, 03:04 PM
  2. auto fill series...but different...maybe?
    By crodgers in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-09-2014, 07:32 PM
  3. [SOLVED] auto fill in a formula series
    By gvmsia in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-18-2014, 04:18 PM
  4. [SOLVED] Fill gap between 2 graphic lines. Set dynamic series.
    By Calio in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-15-2014, 04:22 AM
  5. Dynamic Auto-Fill Range based upon Specific number of rows
    By a333 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2013, 03:54 AM
  6. [SOLVED] auto fill series
    By Dave in forum Excel General
    Replies: 2
    Last Post: 01-19-2005, 02:06 PM
  7. Auto fill dynamic range based on month
    By [nordis] in forum Excel General
    Replies: 0
    Last Post: 01-14-2005, 08:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1