Hi Excel Masters.
I need your help for a code that will work for Mac too. Currently, my code works perfectly fine for Windows but not on Mac, specfically in pasting the sheet from one workbook to another workbook. The copy code works, but I am encountering error in pasting it to another sheet. The error is higlighted at "Sheets(2).Select" line. Here's my code:
Sheets(1).Select
Cells.Select
Selection.Copy
ActiveWorkbook.Close SaveChanges:=False
'Adding new sheet and pasting the SB STR to SP STR file
'Sheets.Add After:=Sheets(2)
Sheets(2).Select
Sheets.Add After:=ActiveSheet
'ActiveSheet.Name = "SB"
sheetName = "SB"
Application.CutCopyMode = False
ActiveSheet.Name = sheetName
'ActiveSheet.Paste
Sheets(sheetName).Paste
Range("A1").Select
Looking forward for your help on this. Thank you so much.
I need your help for a code that will work for Mac too. Currently, my code works perfectly fine for Windows but not on Mac, specfically in pasting the sheet from one workbook to another workbook. The copy code works, but I am encountering error in pasting it to another sheet. The error is higlighted at "Sheets(2).Select" line. Here's my code:
Sheets(1).Select
Cells.Select
Selection.Copy
ActiveWorkbook.Close SaveChanges:=False
'Adding new sheet and pasting the SB STR to SP STR file
'Sheets.Add After:=Sheets(2)
Sheets(2).Select
Sheets.Add After:=ActiveSheet
'ActiveSheet.Name = "SB"
sheetName = "SB"
Application.CutCopyMode = False
ActiveSheet.Name = sheetName
'ActiveSheet.Paste
Sheets(sheetName).Paste
Range("A1").Select
Looking forward for your help on this. Thank you so much.