Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
format cells as "Text"
Hi, I'm copying a some numerical -codes into a range (say "A:B"), some of the codes starts with a zero so, after copy Excel converts them numbers and removes the leading zero. This is creating a slight problem in my program. If anybody knows a way to format the range as Text or String, using VBA in a macro, please let me know. I cannot do the excel formatting and save the sheet coz' the sheet is created based on certain user-input. Thanks in Advance, Maneesh Hari |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
format cells as "Text"
Range("A:B").NumberFormat= "@"
HTH Die_Another_Day Phaedrus wrote: Hi, I'm copying a some numerical -codes into a range (say "A:B"), some of the codes starts with a zero so, after copy Excel converts them numbers and removes the leading zero. This is creating a slight problem in my program. If anybody knows a way to format the range as Text or String, using VBA in a macro, please let me know. I cannot do the excel formatting and save the sheet coz' the sheet is created based on certain user-input. Thanks in Advance, Maneesh Hari |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
format cells as "Text"
DAD :), this option works perfect. (I was trying with = "Text" and it was giving me garbage data) thanks for your help. Really appreciate it. Maneesh Die_Another_Day wrote: Range("A:B").NumberFormat= "@" HTH Die_Another_Day Phaedrus wrote: Hi, I'm copying a some numerical -codes into a range (say "A:B"), some of the codes starts with a zero so, after copy Excel converts them numbers and removes the leading zero. This is creating a slight problem in my program. If anybody knows a way to format the range as Text or String, using VBA in a macro, please let me know. I cannot do the excel formatting and save the sheet coz' the sheet is created based on certain user-input. Thanks in Advance, Maneesh Hari |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
format cells as "Text"
Maneesh, An easy way to figure out formatting is to change it manually in
Excel, select the cell then type ?ActiveCell.NumberFormat in the immediate window in the VBA editor. Glad to be of help to you. Die_Another_Day "Phaedrus" wrote in message oups.com... DAD :), this option works perfect. (I was trying with = "Text" and it was giving me garbage data) thanks for your help. Really appreciate it. Maneesh Die_Another_Day wrote: Range("A:B").NumberFormat= "@" HTH Die_Another_Day Phaedrus wrote: Hi, I'm copying a some numerical -codes into a range (say "A:B"), some of the codes starts with a zero so, after copy Excel converts them numbers and removes the leading zero. This is creating a slight problem in my program. If anybody knows a way to format the range as Text or String, using VBA in a macro, please let me know. I cannot do the excel formatting and save the sheet coz' the sheet is created based on certain user-input. Thanks in Advance, Maneesh Hari |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Combine text from multiple cells into one cell - =(A1&","&A2","&A3 | Excel Worksheet Functions | |||
Format changes from "General" to "Text" | Excel Discussion (Misc queries) | |||
how do I format some text....."abc123" into "abc 123" | Excel Discussion (Misc queries) | |||
cells formatted to tick when text value "Y" if or null if "N" | Excel Discussion (Misc queries) | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) |