Simplest Way to Copy Spreadsheet Values and Formatting to New Unsaved Workbook.

avd88

Board Regular
Joined
Jan 18, 2016
Messages
112
Hello,

Hoping someone can help out.
Trying to copy a worksheet to a new unsaved workbook with the same formatting and without any formulas so that a user can save themselves if they chose to do so.

Been searching in the forum and online but I can only find complex solutions.

Trying to find the simplest way to accomplish this, any ideas?

This is my current VBA code which will copy the exact spreadsheet with formulas:

VBA Code:
    Dim prov As String
    prov = Me.provComboBox.Text

    Worksheets(prov).Copy
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
try this:
VBA Code:
Dim prov As String
    prov = Me.provComboBox.Text

    Worksheets(prov).Copy
inarr = ActiveSheet.UsedRange
ActiveSheet.UsedRange = inarr
 
Upvote 0
Good afternoon
Could you not just add this to the bottom of your code:

workbooks.add
Range("a1").PasteSpecial xlPasteValues
Range("a1").PasteSpecial xlPasteFormats



Obviously assuming you want pasting in a1
Thanks
Jon
 
Upvote 0
offthelip, thanks for your response. It seems to work perfectly!

Jon, thanks for your reply! I am not entirely sure if that code will work with the worksheet.copy method as it immediately opens up a new workbook.
That logic would probably work if I selected and copied the range from the worksheet which is kind of what I was trying to avoid.
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,684
Members
449,048
Latest member
81jamesacct

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