Hi All,
I am attempting to do the following.
Range("A1").value = "050" this returns a result of 50.
I then try Range("A1").value=Cstr("050") again this returns a result of 50.
How can I keep the leading zeroes?
Hi All,
I am attempting to do the following.
Range("A1").value = "050" this returns a result of 50.
I then try Range("A1").value=Cstr("050") again this returns a result of 50.
How can I keep the leading zeroes?
Last edited by Excel Guy 123; 09-12-2014 at 08:20 AM.
Use .text value is the value text is what is displayed
Hope this helps
Sometimes its best to start at the beginning and learn VBA & Excel.
Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
Available for remote consultancy work PM me
Perhaps:-
Regards MickPlease Login or Register to view this content.
I tried Range("A1").text ="050" and it returned a VBA error.
The number format did work.
I actually found using "'050" (' before 050) worked as well.
Thanks all for the help.
Hi
You probably have the cell formatted as General or Number and that's why the leading zero is discarded.
If you specify that the cell format is text you should not have problems with leading zeros.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks