Select previous sheet Macro

  • Hi there,

    Below is a macro I'm trying to create. The basically it's supposed to be a quick simple macro to save lots of time. I want to select current tab, move/copy (create copy) to the end....then select the tab I've just copied and copy paste special the values (then rename the tab to todays date) FYI the tab I'm copying is called rebuy shipping.

    However, I want to then do the same at a later date with the most recent tab, but with the below code it always selects and copies the original tab:

    Sub macrorebuy1()
    ' macrorebuy1 Macro
    ' Keyboard Shortcut: Ctrl+k
    Sheets("Rebuy Shipping").Select
    Sheets("Rebuy Shipping").Copy Before:=Sheets(4)
    Sheets("Rebuy Shipping").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    End Sub

    I assume this is a simple error. I've tried inserting Activesheet.previous but I'm doing something wrong! Please help! :)

  • Re: Select previous sheet Macro

    Please refer to the rules you agreed to when you joined the forum.

    Rule #1 - Please use code tags when posting code.

    Code tags format and colourise the code making it easier to read and so follow the logic. They are required regardless how short your code snippet might be.

    Please edit your post accordingly. You add code tags by clicking the 'Edit Post' link beneath the message, highlighting the code and clicking the '#' button on the edit window tool bar.

  • Re: Select previous sheet Macro

    Try this.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!