Copy worksheet from personal.xlsb to the active sheet

DENWARD

Board Regular
Joined
Oct 29, 2012
Messages
113
My goal is to copy a lookup table that I maintain in Personal.xlsb and paste it into whatever worksheet that is currently open on the desktop. The destination filename constantly changes (currently TESTERPASTE.XLSX) so I want it to paste it on whatever worksheet is currently open on my desktop. Is that possible ??

My humble attempt gives me an error message on line 2. Text entered is not a valid reference or defined name

Sub testerpastermacro()
'
' testerpastermacro Macro
'
'
Windows("PERSONAL.XLSB").Visible = True
Application.Goto Reference:="ENTIRELOOKUPTABLE"
Selection.Copy
Windows("TESTERPASTE.xlsx").Activate
Range("A1").Select
ActiveSheet.Paste

End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I would check (again) that that name exists in your PERSONAL.XLSB. By the way you don't need to activate/select to copy paste. What's the name of the worksheet to which you want to copy?
 
Upvote 0
Does this work for you?

Code:
Sub Test()
    Workbooks("PERSONAL.XLSB").Worksheets(1).Range("ENTIRELOOKUPTABLE").Copy ActiveSheet.Range("A1")
End Sub
 
Upvote 0
I cannot tell you how much I sincerely appreciate your assistance. So simple , so direct.
 
Upvote 0
Mr. Poulsom,
You assisted me with the code below. I hate to be a pest , but, I need to copy "defined range names" and formatting. It does not copy those to the new workbook. Is that possible ?

Sub Test()
Workbooks("PERSONAL.XLSB").Worksheets(1).Range("ENTIRELOOKUPTABLE").Copy ActiveSheet.Range("A1")
End Sub
 
Upvote 0
What else is on the active sheet? Maybe you can copy the entire sheet instead of the range:

Code:
Workbooks("PERSONAL.XLSB").Worksheets(1).Copy Before:=ActiveWorkbook.Worksheets(1)
 
Upvote 0
I actually named the entire worksheet as a defined range, used your recommendation to copy it and it pasted beautifully! But the range names and formats did not transfer over. So close...
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top