Hi All,
I’m stuck with a problem that I’m sure is very simple to solve, but my brain is just not working today.
I need to copy a range from workbook A, paste it in workbook B, then copy another range from workbook B and paste it in workbook A.
Workbook B always has the same file and sheet name, but for Workbook A, the file name and sheet name are always different.
This is my code:
Sub Macro1()
Dim myWb As Workbook
Dim mySheetName As String
mySheetName = ActiveSheet.Name
Range("A:G"). Copy
Workbooks("Personal.xlsm"). Sheets(2).Activate ‘ this always the same workbook and sheet
Range("A1").Select
ActiveSheet.Paste
…Rest of my code, and then …
Range("H:H").Copy
and now, how do I go back to Workbook A to paste it there????
i though something like the below should work but it doesn't
ActiveWorkbook.Worksheets(mySheetName).Activate
Range("H1").Select
ActiveSheet.Paste
please?
Bookmarks