+ Reply to Thread
Results 1 to 9 of 9

Paste data on next available row

Hybrid View

  1. #1
    Registered User
    Join Date
    03-20-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2007
    Posts
    5

    Unhappy Paste data on next available row

    Hi all,

    I'm running a macro to copy data from a form I've created to the master worksheet that is located within the workbook. I've tried for hours to make this macro run how I'd like and am on the verge of giving up, but thought I'd ask(Beg) for help first.

    I've had so many unsuccessful revisions that I went back to the drawing board and recorded the macro fresh as listed below. The ultimate goal is to be able to have the locations that are being pasted (Row 8) be incremented to the next row each time the macro runs. Any help is greatly appreciated. The code I'm using is below.

    Turk

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
        Range("B2").Select
        Selection.Copy
        Sheets("Concessions").Select
        Range("C8").Select
        ActiveSheet.Paste
        Sheets("Enter New Data").Select
        Range("B4").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Concessions").Select
        Range("G8").Select
        ActiveSheet.Paste
        Sheets("Enter New Data").Select
        Range("B6").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Concessions").Select
        ActiveWindow.SmallScroll Down:=-3
        Range("B8").Select
        ActiveSheet.Paste
        Sheets("Enter New Data").Select
        Range("B8").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Concessions").Select
        Range("D8").Select
        ActiveSheet.Paste
        Sheets("Enter New Data").Select
        Range("B12").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Concessions").Select
        Range("F8").Select
        ActiveSheet.Paste
        Sheets("Enter New Data").Select
        Range("B12,B8,B6,B4,B2").Select
        Range("B2").Activate
        Application.CutCopyMode = False
        Selection.ClearContents
        ActiveWindow.SmallScroll Down:=-6
    End Sub

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Paste data on next available row

    Hi Pauay,

    Welcome to the Forum

    I'm guessing:

    Sub Pauay(): Dim wc As Worksheet, we As Worksheet, r As Long
    Set wc = Sheets("Concessions"): Set we = Sheets("Enter New Data")
        r = we.Range("C1").End(xlDown).row + 1
        we.Range("B2").copy wc.Range("C" & r)
        we.Range("B4").copy wc.Range("G" & r)
        we.Range("B6").copy wc.Range("B" & r)
        we.Range("B8").copy wc.Range("D" & r)
        we.Range("B12").copy wc.Range("F" & r)
        we.Range("B12,B8,B6,B4,B2").ClearContents
    End Sub
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    03-20-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2007
    Posts
    5

    Re: Paste data on next available row

    OOPs... Forgot to say. Thanks for the quick reply. I really appreciate any assistance I can get on this.

  4. #4
    Registered User
    Join Date
    03-20-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2007
    Posts
    5

    Re: Paste data on next available row

    Sadly this didn't work. I received an error: Method 'Range' of object'_Worksheet' failed.

    Also your reply made me realize I missed an L in my name... Should have been Paulydaturk...

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Paste data on next available row

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic


    AND _ Thanks for the rep!

  6. #6
    Registered User
    Join Date
    03-20-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2007
    Posts
    5

    Re: Paste data on next available row

    So I've attached the work book.

    The goal is to fill out the form in worksheet Enter new Data and have it paste across to the appropriate cells in the Concessions tab.

    Let me know if you can make heads or tails of it.

    SE Concession tracking.xlsx

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Paste data on next available row

    Try this:

    Sub Pauay(): Dim wc As Worksheet, we As Worksheet, r As Long
    Set wc = Sheets("Concessions"): Set we = Sheets("Enter New Data")
        r = 6: Do Until wc.Range("C" & r) = "": r = r + 2: Loop
        we.Range("B2").copy wc.Range("C" & r)
        we.Range("B4").copy wc.Range("G" & r)
        we.Range("B6").copy wc.Range("B" & r)
        we.Range("B8").copy wc.Range("D" & r)
        we.Range("B12").copy wc.Range("F" & r)
        we.Range("B12,B8,B6,B4,B2").ClearContents
    End Sub

  8. #8
    Registered User
    Join Date
    03-20-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2007
    Posts
    5

    Re: Paste data on next available row

    Just got back to the office and tried your code. I adjusted it slightly because it was moving 2 lines down but it worked! Thansk for the assistance, xladept! Made what could have been a frustrating Monday morning much more bearable.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Paste data on next available row

    You're welcome!

+ 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. copy formula and paste for new data added and autofill.....and paste special values
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2014, 07:40 AM
  2. Replies: 6
    Last Post: 03-26-2014, 11:40 PM
  3. [SOLVED] ActiveSheet.Paste Link:= True Does Not Work After Awhile - 1004 MS Excel cannot paste data
    By zfeinstein in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-25-2013, 04:28 PM
  4. Replies: 1
    Last Post: 10-01-2012, 11:11 PM
  5. Replies: 2
    Last Post: 02-22-2011, 02:07 AM

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