Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When I copy cell contents that looks like "00030" into a string array, then
later check the array contents it looks like: "30". I need to keep the leading zeros in the variable. Anyone have a quick and easy way to do this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Depends on how you copy cells into a string array. If you do it all at
once, then you are transferring the values and the only way to do it would be to change the value of the cell (or loop through the array and change the value stored in the array). If you are looping through cells and making the assignment element by element, then use the Text property of the cell rather than the Value property. -- Regards, Tom Ogilvy "quartz" wrote in message ... When I copy cell contents that looks like "00030" into a string array, then later check the array contents it looks like: "30". I need to keep the leading zeros in the variable. Anyone have a quick and easy way to do this? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you say that when you load the array the value looks like 00030, are you
loading an integer formatted to show leading zeros or are you loading a string? Also when you say that you check later on are you outputting the data to a cell where implicit conversion may be happening or are you placing a watch on the variable and checking it's contents? Another question is you say that it is an array of strings. Is it declared as an array of strings or is it declared as variant? Is it ever passed to a sub where the argument is declared either as variant (or not declared which is implicitly variant)? -- HTH... Jim Thomlinson "quartz" wrote: When I copy cell contents that looks like "00030" into a string array, then later check the array contents it looks like: "30". I need to keep the leading zeros in the variable. Anyone have a quick and easy way to do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Array formula to Identify Leading Zeros. | Excel Discussion (Misc queries) | |||
Leading zeros | Excel Discussion (Misc queries) | |||
save text field w/ leading zeros in .csv format & not lose zeros? | Excel Discussion (Misc queries) | |||
Leading zeros | Excel Discussion (Misc queries) | |||
Removing Leading Zeros from a String | Excel Programming |