R
Rich
I have a column of numbers that range from 5 to 10 digits
in length for each number. This column is general
format. Each cell in this column needs to contain a
uniform string length of 10. So I format the column as
custom 0000000000, with leading zeroes.
Selection.NumberFormat = "0000000000"
Ideally, this would now be text data instead of numbers.
But if I loop through this column as follows,
------------------------------------
Dim rng as range, i as integer
Set rng = Range("A1:A10")
For i = 1 to rng.rows.count
debug.print rng(i, 1)
Next
-----------------------------------
I am reading the original numbers without the leading
zeroes. The question is "how can I read the data in this
column with the custom format instead of the general
format? Could I set the custom format as I retrieve the
general formatted data? Or do I have to format the column
as text and add the leading zeroes using string
manipulation?
Thanks,
Rich
in length for each number. This column is general
format. Each cell in this column needs to contain a
uniform string length of 10. So I format the column as
custom 0000000000, with leading zeroes.
Selection.NumberFormat = "0000000000"
Ideally, this would now be text data instead of numbers.
But if I loop through this column as follows,
------------------------------------
Dim rng as range, i as integer
Set rng = Range("A1:A10")
For i = 1 to rng.rows.count
debug.print rng(i, 1)
Next
-----------------------------------
I am reading the original numbers without the leading
zeroes. The question is "how can I read the data in this
column with the custom format instead of the general
format? Could I set the custom format as I retrieve the
general formatted data? Or do I have to format the column
as text and add the leading zeroes using string
manipulation?
Thanks,
Rich