Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to convert specific Numbers to Letters...
Hello,
I was wondering if anyone would have an Excel macro that would allow me to convert any number starting or ending with a ZERO to a letter such as X,Y,or Z. If not, just a macro that would convert any ZERO to an X would work fine. I'm tired of having to change my columns to text every time I move something around or do a TEXT to COLUMN conversion. I work with many pseudo numbers like: 0012, 0003450, etc. Of course, since these are not real numbers as such, EXCEL can't accept them. Thanks for any help or advice you can offer. SGR |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to convert specific Numbers to Letters...
Is this what you want?
Sub convert0() If Left([m5], 1) = 0 _ Or Right([m5], 1) = 0 _ Then [m5] = "x" End Sub -- Don Guillett SalesAid Software "Steven Ratliff" wrote in message om... Hello, I was wondering if anyone would have an Excel macro that would allow me to convert any number starting or ending with a ZERO to a letter such as X,Y,or Z. If not, just a macro that would convert any ZERO to an X would work fine. I'm tired of having to change my columns to text every time I move something around or do a TEXT to COLUMN conversion. I work with many pseudo numbers like: 0012, 0003450, etc. Of course, since these are not real numbers as such, EXCEL can't accept them. Thanks for any help or advice you can offer. SGR |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to convert specific Numbers to Letters...
Try using Replace()
Something like cell.value = replace(cell.value,"0","x") /i. "Steven Ratliff" wrote in message om... Hello, I was wondering if anyone would have an Excel macro that would allow me to convert any number starting or ending with a ZERO to a letter such as X,Y,or Z. If not, just a macro that would convert any ZERO to an X would work fine. I'm tired of having to change my columns to text every time I move something around or do a TEXT to COLUMN conversion. I work with many pseudo numbers like: 0012, 0003450, etc. Of course, since these are not real numbers as such, EXCEL can't accept them. Thanks for any help or advice you can offer. SGR |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to convert specific Numbers to Letters...
for each cell in selection.SpecialCells(xlConstants,xlTextValues)
cell.Value = Application.Substitute(cell.Text,"0","X") Next to reverse for each cell in selection.SpecialCells(xlConstants,xlTextValues) cell.Value = "'" & Application.Substitute(cell.Text,"X","0") Next -- Regards, Tom Ogilvy Steven Ratliff wrote in message om... Hello, I was wondering if anyone would have an Excel macro that would allow me to convert any number starting or ending with a ZERO to a letter such as X,Y,or Z. If not, just a macro that would convert any ZERO to an X would work fine. I'm tired of having to change my columns to text every time I move something around or do a TEXT to COLUMN conversion. I work with many pseudo numbers like: 0012, 0003450, etc. Of course, since these are not real numbers as such, EXCEL can't accept them. Thanks for any help or advice you can offer. SGR |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I convert letters to numbers in Excel? | Excel Discussion (Misc queries) | |||
Convert numbers to letters in excel | Excel Worksheet Functions | |||
convert letters to numbers | Charts and Charting in Excel | |||
Convert letters into numbers. i.e. ABCD = 52 | Excel Worksheet Functions | |||
How to convert numbers to corresponding letters? Ex: 123 to abc | Excel Discussion (Misc queries) |