You need to be careful using .Text because that gets the formatted property
at the last calculation and reformat, which may have inadvertently been
changed to ###### without you noticing because of formatting or zoom changes
etc.
Its usually safer to assign the .Value to a string variable and then return
it to a cell which is formatted the same way as the origin.
(You can copy the formatting using .Copy and .PasteSpecial xlPasteFormats )
regards
Charles
____________________________
The Excel Calculation Site
http://www.decisionmodels.com
"Rick Rothstein (MVP -
VB)" wrote in
message ...
What do you mean when you say "a cell dim as social security"? Do you mean
it is formatted on the worksheet as...
Format Cells/Special/Social Security Number
If so, then in your code, Dim your variable as String, but don't assign
the Value property of the Cell to it; rather, assign the Cell's Text
property to it. For one example...
YourStringVariable = ActiveSheet.Cells(3,4).Text
Rick
"John" wrote in message
...
a cell is dim as social security. I want to copy that to a variable. What
do I dim the variable as?
If I use string, then when I copy it to a different cell dim as social
security it shows up as #######.
If I use some number like integer or double it doesn't get the whole
number.
Thanks
john