+ Reply to Thread
Results 1 to 6 of 6

Creating a log using a macro assigned button

  1. #1
    Registered User
    Join Date
    04-17-2013
    Location
    Statesville, NC
    MS-Off Ver
    Excel 2007
    Posts
    5

    Creating a log using a macro assigned button

    I currently have a macro recorded and assigned to a button that completes a simple copy from several different cells on one sheet, named "Input", and pastse them into another sheet, named "Data Log". The recorded macro only pastes the values to the same cells in "Data Log" every time. I need the macro to recognize previously copied and pasted data and paste the values into the next row in the "Data Log". Any advise or help would be greatly appreciated. Below is the recorded macro and the excel file is attached. Thanks!

    Sub Log_Data()
    '
    ' Log_Data Macro
    '

    '
    Range("A2").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C3").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("C5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C4").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("D5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C9").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("E5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("D9").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("F5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C10").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("G5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C13").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("H5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C12").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("I5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C20").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("J5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("K5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C22").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("L5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("C23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("M5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("D20").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("N5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("D21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("O5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("D22").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("P5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Input").Select
    Range("D23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data Log").Select
    Range("Q5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    End Sub
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: Creating a log using a macro assigned button

    Try this. You'll have to work with formatting your Data Log sheet, but otherwise it should work just fine for you.
    Please Login or Register  to view this content.
    Last edited by jomili; 04-18-2013 at 12:35 PM.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Creating a log using a macro assigned button

    Hi, cudoig,

    Please Login or Register  to view this content.
    Please use Code-Tags to wrap the procedure.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: Creating a log using a macro assigned button

    Posted in error. Ignore this post.
    Last edited by jomili; 04-18-2013 at 12:36 PM.

  5. #5
    Registered User
    Join Date
    04-17-2013
    Location
    Statesville, NC
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Creating a log using a macro assigned button

    Thank you very much for the help!

  6. #6
    Registered User
    Join Date
    04-17-2013
    Location
    Statesville, NC
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Creating a log using a macro assigned button

    Thank you!

+ 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