Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have cells that contain non-displaying characters, like line feeds.
How can I determine all the dec values in a cell? Example, "abc" would be 97 98 99 That's obvious, the "abc" would just show up. I want to also determine all the non-display characters like line feeds and charriage returns in a given cell. -- Richard |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your ultimate goal (all decimal values/only non-displaying character's
values) is not completely clear to me. The Asc function can be used to find the ASCII/ANSI value of an individual character. The following function will display these values (surrounded by angle brackets) for each character in the text passed into it... Function FindNonPrintableChars(TextIn As String) As String Dim X As Long For X = 1 To Len(TextIn) FindNonPrintableChars = FindNonPrintableChars & _ "<" & Asc(Mid$(TextIn, X, 1)) & "" Next End Function If you only want to see the values for the non-displaying characters, then this function will probably do what you want... Function FindNonPrintableChars(TextIn As String) As String Dim X As Long Dim Letter As String For X = 1 To Len(TextIn) Letter = Mid$(TextIn, X, 1) If Asc(Letter) < 32 Then FindNonPrintableChars = FindNonPrintableChars & _ "<" & Asc(Mid$(TextIn, X, 1)) & "" Else FindNonPrintableChars = FindNonPrintableChars & Letter End If Next End Function Rick "Richard" wrote in message ... I have cells that contain non-displaying characters, like line feeds. How can I determine all the dec values in a cell? Example, "abc" would be 97 98 99 That's obvious, the "abc" would just show up. I want to also determine all the non-display characters like line feeds and charriage returns in a given cell. -- Richard |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Rick,
I was able to find this function on the web,and it worked fine for me Dim i As Long Dim x() As Byte x = StrConv(Range("a3").Value, vbFromUnicode) ' Convert string. For i = 0 To UBound(x) Debug.Print x(i) Next -- Richard "Rick Rothstein (MVP - VB)" wrote: Your ultimate goal (all decimal values/only non-displaying character's values) is not completely clear to me. The Asc function can be used to find the ASCII/ANSI value of an individual character. The following function will display these values (surrounded by angle brackets) for each character in the text passed into it... Function FindNonPrintableChars(TextIn As String) As String Dim X As Long For X = 1 To Len(TextIn) FindNonPrintableChars = FindNonPrintableChars & _ "<" & Asc(Mid$(TextIn, X, 1)) & "" Next End Function If you only want to see the values for the non-displaying characters, then this function will probably do what you want... Function FindNonPrintableChars(TextIn As String) As String Dim X As Long Dim Letter As String For X = 1 To Len(TextIn) Letter = Mid$(TextIn, X, 1) If Asc(Letter) < 32 Then FindNonPrintableChars = FindNonPrintableChars & _ "<" & Asc(Mid$(TextIn, X, 1)) & "" Else FindNonPrintableChars = FindNonPrintableChars & Letter End If Next End Function Rick "Richard" wrote in message ... I have cells that contain non-displaying characters, like line feeds. How can I determine all the dec values in a cell? Example, "abc" would be 97 98 99 That's obvious, the "abc" would just show up. I want to also determine all the non-display characters like line feeds and charriage returns in a given cell. -- Richard |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, a Byte array solution will also work (assuming you want all characters
to be converted to their ASCII/ANSI decimal values). Rick "Richard" wrote in message ... Thanks Rick, I was able to find this function on the web,and it worked fine for me Dim i As Long Dim x() As Byte x = StrConv(Range("a3").Value, vbFromUnicode) ' Convert string. For i = 0 To UBound(x) Debug.Print x(i) Next -- Richard "Rick Rothstein (MVP - VB)" wrote: Your ultimate goal (all decimal values/only non-displaying character's values) is not completely clear to me. The Asc function can be used to find the ASCII/ANSI value of an individual character. The following function will display these values (surrounded by angle brackets) for each character in the text passed into it... Function FindNonPrintableChars(TextIn As String) As String Dim X As Long For X = 1 To Len(TextIn) FindNonPrintableChars = FindNonPrintableChars & _ "<" & Asc(Mid$(TextIn, X, 1)) & "" Next End Function If you only want to see the values for the non-displaying characters, then this function will probably do what you want... Function FindNonPrintableChars(TextIn As String) As String Dim X As Long Dim Letter As String For X = 1 To Len(TextIn) Letter = Mid$(TextIn, X, 1) If Asc(Letter) < 32 Then FindNonPrintableChars = FindNonPrintableChars & _ "<" & Asc(Mid$(TextIn, X, 1)) & "" Else FindNonPrintableChars = FindNonPrintableChars & Letter End If Next End Function Rick "Richard" wrote in message ... I have cells that contain non-displaying characters, like line feeds. How can I determine all the dec values in a cell? Example, "abc" would be 97 98 99 That's obvious, the "abc" would just show up. I want to also determine all the non-display characters like line feeds and charriage returns in a given cell. -- Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro - Insert Equal Sign to Convert String to Formula | Excel Discussion (Misc queries) | |||
Convert to string help | Excel Discussion (Misc queries) | |||
Convert string | Excel Programming | |||
macro to convert text string | Excel Programming | |||
macro to convert text string | Excel Programming |