Copy a worksheet to another workbook as values but without changing the format of original results

David Montoya

New Member
Joined
Apr 25, 2018
Messages
49
Dear, I have a worksheet, which contains many formulas; I need to copy this worksheet to a separate workbook without the formulas (value only). The problem I am facing is that by using the macro below, it changes results such as 210.000 to 210, and I need to maintain the original result as 210.000.
Code:
Sheets("Std").Copy
With ActiveSheet.UsedRange
    .Value = .Value
End With
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the Board!

it changes results such as 210.000 to 210
The formula that is returning this "210.000", is it a hard-coded entry or a formula?
Either way, I am guessing that you have a text value there that you are converting to numeric with your code, as the code above does not alter the formatting on the cells.
So as it converts from text to number, the decimals are being dropped.
 
Last edited:
Upvote 0
Yes, it is a text result from a formula. I need to maintain the same format in order to not drop the decimals. The code I need is to maintain the same format/information. When I debug the code, the portion ".Value = .Value" is the one that does the conversion from 210.000 to 210. Is there a way to modify this portion of the code to retain the text values; but at the same time to eliminate the formulas from the source worksheet?
 
Upvote 0
Please post your formula.
 
Upvote 0
Here is the formula: "=IF(Q4="","",IF(VLOOKUP($Q4,FDA!$A:$F,4,0)=0,"",VLOOKUP($Q4,FDA!$A:$F,4,0)))". It is a query from an Excel DB, which contain the mentioned value of 210.000 as text (many other similar values exist, all with three decimal zeros).
 
Upvote 0
If all the numbers have three decimal places, then just format the columns to numbers with 3 decimals BEFORE running your VBA code.
Or, simply add VBA code to the top that does the formatting for you. If you turn on the Macro Recorder, and record yourself applying the format, it will give you the code that you need.
 
Upvote 0

Forum statistics

Threads
1,214,431
Messages
6,119,457
Members
448,898
Latest member
drewmorgan128

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