KhanofTarkir
New Member
- Joined
- Sep 3, 2014
- Messages
- 24
Hi everyone,
My VBA is rather basic - I was wondering if there is a way to program a macro to copy the currently selected sheet (whatever sheet you are on) and paste it into a separate workbook?
I came up with this code to paste sheet A from the current workbook (workbook 1) to workbook 2, but I don't think it works with sheet B (if you execute the macro while on sheet B, it just takes sheet A and copies it to workbook 2). I am trying to create a flexible macro that allows me to just copy the current sheet from the current workbook (not necessarily workbook 1) and paste it into another open workbook (not necessarily workbook 2).
Any help would be greatly appreciated - thanks!
My VBA is rather basic - I was wondering if there is a way to program a macro to copy the currently selected sheet (whatever sheet you are on) and paste it into a separate workbook?
I came up with this code to paste sheet A from the current workbook (workbook 1) to workbook 2, but I don't think it works with sheet B (if you execute the macro while on sheet B, it just takes sheet A and copies it to workbook 2). I am trying to create a flexible macro that allows me to just copy the current sheet from the current workbook (not necessarily workbook 1) and paste it into another open workbook (not necessarily workbook 2).
Code:
Sub PasteSheetOtherWB()'
' CopyPasteSheettoOtherWB Macro
'
' Keyboard Shortcut: Ctrl+Shift+A
'
Sheets("Sheet A").Select
Sheets("Sheet A").Copy Before:=Workbooks("Workbook2").Sheets( _
1)
End Sub
Any help would be greatly appreciated - thanks!