+ Reply to Thread
Results 1 to 4 of 4

Using a macro to copying data from 1 sheet, and pasting into next empty cell

Hybrid View

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Northampton, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Using a macro to copying data from 1 sheet, and pasting into next empty cell

    Hi,

    I know that there are a few examples on how to do this but trial and error and proved to frustrating on this one.

    I need to enter data into specific cells and when the macro is run, it copies this data and pastes into the next available(empty) row in my database sheet.

    I copied the codebelow code from another thread, however i can't seem to be able to incorporate it into my specific example.

    [Range("B3").End(xlDown).Offset(1,0)
    Please see below complete code i'm working with, the action needs to be completed twice for different data and then pasted into the emply cell Range for columns B and H:


    updatedatabase Macro
    '
    
    '
        Range("B23:E23").Select
        Selection.Copy
        Sheets("Database").Select
        Range("B175").Select
        Selection.End(xlDown).Select
        ActiveWindow.SmallScroll Down:=6
        Range("B3").End(xlDown).Offset(1,0)
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("Top Line Checker").Select
        Range("H23:K23").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Database").Select
        Range("H3").End(xlDown).Offset(1,0)
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Range("L186").Select
        Sheets("Top Line Checker").Select
        Range("I25").Select
    End Sub
    Any help is greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using a macro to copying data from 1 sheet, and pasting into next empty cell

    I do not know this line Acti
    veWindow.SmallScroll Down:=6
    , but try this line

    Range("B23:E23").Copy Sheets("Database").Range("B3").End(xlDown).Offset(1, 0)

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using a macro to copying data from 1 sheet, and pasting into next empty cell

    This is recorded macro code, so I have removed the selelction bit of the code, but have not tested it.

    updatedatabase Macro
    
        Range("B23:E23").Copy
        Sheets("Database").Range("B175").End(xlDown).Select
        ActiveWindow.SmallScroll Down:=6
        Range("B3").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
        Sheets("Top Line Checker").Range("H23:K23").Copy
        Application.CutCopyMode = False
        Sheets("Database").Range("H3").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
        Range("L186").Select
        Sheets("Top Line Checker").Range("I25")
        
    End Sub

  4. #4
    Registered User
    Join Date
    12-13-2012
    Location
    Northampton, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Using a macro to copying data from 1 sheet, and pasting into next empty cell

    Thanks AB33,

    The second line helped a treat....works perfectly.

+ 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