+ Reply to Thread
Results 1 to 2 of 2

Autofill not knowing the no. of rows.

  1. #1
    Forum Contributor
    Join Date
    08-15-2005
    Location
    Oklahoma
    MS-Off Ver
    2010, 2013
    Posts
    112

    Autofill not knowing the no. of rows.

    How do I autofill rows when I don't know the no. of rows?

    Sub INSERT()
    '
    Columns("A:A").Select
    Selection.INSERT Shift:=xlToRight
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "2"
    Range("A1").Select
    Selection.AutoFill Destination:=Range("A1:A686")
    Range("A1:A686").Select
    Selection.Copy
    Columns("C:C").Select
    Selection.INSERT Shift:=xlToRight
    Range("C1").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "1"
    Range("C1").Select
    Selection.AutoFill Destination:=Range("C1:C686")
    Range("C1:C686").Select
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-2],RC[-1])"
    Selection.AutoFill Destination:=Range("E1:E686")
    Range("E1:E686").Select
    Selection.Copy
    Columns("C:C").Select
    Selection.INSERT Shift:=xlToRight
    Columns("C:C").Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Columns("F:F").Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Columns("A:B").Select
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
    Columns("B:C").Select
    Selection.Delete Shift:=xlToLeft
    Cells.Select
    Selection.Columns.AutoFit
    Range("B17").Select
    End Sub
    Jim15

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Autofill not knowing the no. of rows.

    Jim, please edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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