ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy/paste number as text (https://www.excelbanter.com/excel-programming/381723-copy-paste-number-text.html)

Otto Moehrbach

Copy/paste number as text
 
Excel XP & Win XP
I have a bunch of 10-digit contract numbers I need to copy and paste in
a VBA routine. Say I have 1234567895. I am using "PasteSpecial
xlPasteValues" because I don't want to carry the formatting over to the
destination (colors, font size, etc).
Excel insists on pasting the numbers in scientific notation.
I tried formatting the destination cell to Text before pasting.
I tried formatting the source cell to Text before copying.
I tried both at the same time.
The pasted number is still in scientific notation.
How can I copy/paste the contract number in its original form?
Thanks for your time. Otto



Otto Moehrbach

Copy/paste number as text
 
Thanks Tom. I'll give that a try in the morning. Otto
"Tom Ogilvy" wrote in message
...
If you really want it as text, then don't paste

dim dest as Range, source as Range
set dest =
set source =

dest.Value = "'" & source.value

--
Regards,
Tom Ogilvy


"Otto Moehrbach" wrote:

Excel XP & Win XP
I have a bunch of 10-digit contract numbers I need to copy and paste
in
a VBA routine. Say I have 1234567895. I am using "PasteSpecial
xlPasteValues" because I don't want to carry the formatting over to the
destination (colors, font size, etc).
Excel insists on pasting the numbers in scientific notation.
I tried formatting the destination cell to Text before pasting.
I tried formatting the source cell to Text before copying.
I tried both at the same time.
The pasted number is still in scientific notation.
How can I copy/paste the contract number in its original form?
Thanks for your time. Otto







All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com