Results 1 to 5 of 5

Fix macro to work when worksheets are added

Threaded View

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Keene, NH
    MS-Off Ver
    Excel 2010
    Posts
    3

    Fix macro to work when worksheets are added

    I have a macro that was working well. It was copying the outputs from 2 merged & concatenated cels, and pasting the results into a separate worksheet. However, I have another macro that launches a new blank worksheet/form and it adds changes the worksheet name by NEW PLATE, then NEW PLATE (2), NEW PLATE (3) and so on. As a result, my maco fails.

    In addition to the needed fix, I would also like to have the macro paste the data into another workbook as well.

    Code: 
    Sub Macro10()
    '
    ' Macro10 Macro
    '
    ' Keyboard Shortcut: Ctrl+f
    '
        Range("B6:G6").Select
        Selection.Copy
        LR = Sheets("NEW PLATE").Range("B" & Rows.Count).End(xlUp).Row + 1
        Sheets("LIST-SUMMARY").Select
        lMaxRows = Cells(Rows.Count, "B").End(xlUp).Row
        Range("B" & lMaxRows + 1).Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("NEW PLATE.Count").Select
        Range("I6:AF6").Select
        Selection.Copy
        LR = Sheets("NEW PLATE").Range("B" & Rows.Count).End(xlUp).Row + 1
        Sheets("LIST-SUMMARY").Select
        lMaxRows = Cells(Rows.Count, "I").End(xlUp).Row
        Range("I" & lMaxRows + 1).Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            
        Sheets("NEW PLATE").Select
    End Sub
    Thank you
    Last edited by JBeaucaire; 04-02-2013 at 06:59 PM. Reason: Added code tags, as per Forum Rules. Don't forget! Read the rule in the menu bar above. Thanks.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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