+ Reply to Thread
Results 1 to 8 of 8

autofill without the sequential numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    06-11-2010
    Location
    Anahiem, California
    MS-Off Ver
    Excel 2007
    Posts
    14

    autofill without the sequential numbers

    hello,

    i'd like to copy "b1:b3" then autofill till the last row of column "a" without it being sequential on the numbers and fill in the last 2 blank rows of the last data cell of "a", the 1st attachment (columnsample) shows what this code keeps doing:

    Sub Step2Add_New_Column()
    '
    ' Step2Add_New_Column Macro
    '
    
    '
    
        Dim lrow As Long
        
        lrow = Cells(Rows.Count, 1).End(xlUp).Row
        
        Range("B1:B3").autofill Destination:=Range("B1:B" & lrow), Type:=xlFillDefault
    
    End Sub


    i'd like it to look like the 2nd attachment (columnsample1) i have files that have 3000 lines and i'd like to save time to just run a macro instead of manually copying and pasting. appreciate the time/help in advance!
    Attached Files Attached Files
    Last edited by lancejularbal; 06-12-2010 at 12:21 PM. Reason: updating attached file and following forum rules

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: autofill without the sequential numbers

    Lance, please edit your post above and put code tags around that code, as per forum rules. Like so:

    Option Explicit
    
    Sub Step2Add_New_Column()
    Dim LRow As Long
    
        LRow = Cells(Rows.Count, 2).End(xlUp).Row
        Range("B1:B3").Copy Destination:=Range("B4:B" & LRow)
    
    End Sub
    Try that macro instead.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-11-2010
    Location
    Anahiem, California
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: autofill without the sequential numbers

    sorry about that. it ended up doing this (via attachment - columnsampleerror)
    Attached Files Attached Files
    Last edited by shg; 06-11-2010 at 02:46 PM. Reason: deleted spurious quote

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

    Re: autofill without the sequential numbers

    Lance, please don't quote whole posts. It's just clutter.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: autofill without the sequential numbers

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  6. #6
    Registered User
    Join Date
    06-11-2010
    Location
    Anahiem, California
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: autofill without the sequential numbers

    sorry, i don't mean to be rude, but no my problem hasn't been solved. i posted the result of your suggestion, but hasn't given me justice. i appreciate the time though. i hope something comes up soon. i'm putting my time into these macro books to find the solution.

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

    Re: autofill without the sequential numbers

    Sub x()
        Dim nRow As Long
    
        nRow = Cells(Rows.Count, "A").End(xlUp).Row + 2
        Range("B1:B3").AutoFill Destination:=Range("B1").Resize(nRow), Type:=xlFillCopy
    End Sub

  8. #8
    Registered User
    Join Date
    06-11-2010
    Location
    Anahiem, California
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: autofill without the sequential numbers

    Thank you it worked flawlessly. I appreciate it, it'll save me lots of time and work.

+ 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