LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default newbie: force paste as text?

Using XL2003...

I have a source worksheet that has numbers stored as text, with leading
zeros.
I load that worksheet into an array for faster processing
I use a msgbox to confirm that I still have my full string values, including
leading zeros

but for everything I've tried, when I paste those values back into other
cells, they show up as numeric and I lose my leading zeros. The overall
length of the string, and the number of leading zeros can vary.

Sub pasteavalue()
Dim rets As String
rets = (Sheet4.Range("C6712").Value)
MsgBox rets ' shows 05315
Sheet4.Range("G6712").Value= rets ' pastes as numeric 5315
End Sub

I'm sure this must be simple, but a google search and help file search
hasn't turned up any solutions (maybe I'm missing a key search term or
something).

The problem is that I then use the pasted value to pull data from another
file that includes the leading zeros, and because of this situation, it
doesn't find any matches.

Many thanks for any assistance!
Keith


--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Force text to overlap Aled Davies Setting up and Configuration of Excel 3 April 7th 23 12:23 PM
excel save as csv - force text qualifier on every text field Newbie-Don Excel Discussion (Misc queries) 6 April 2nd 23 08:33 PM
newbie - how to paste into an occupied cell Vic Baron New Users to Excel 5 June 5th 08 07:52 PM
How to force a paste of values only? Joe HM Excel Programming 3 March 21st 06 12:06 AM
Copy cells and paste to an address given in another cell (VBA Newbie) WightRob Excel Programming 4 October 23rd 05 11:27 PM


All times are GMT +1. The time now is 05:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"