Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to delete 'tick' Character
A couple of days ago Gord Dibben gave me a macro to delete all 'hard
returns'. The code is below: Sub Remove_CR_LF() With Selection ..Replace What:=Chr(39), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False ..Replace What:=Chr(146) & Chr(10), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False ..Replace What:=Chr(180), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False End With End Sub The macro works great and I was trying to play with it to get it to delete all tick marks, which are those little characters that appear at the front of text, and some numbers, when you do a copy/paste special. I tried to identify the character by putting 1-256 in a column and referencing each cell with the =char() function. I wanted to find the appropriate identifier and then add it in the parentheses in: ..Replace What:=Chr(39), I can't seem to find the identifier for these characters though. I thought it may be 39, 96, 145, or 146, but none of these seem to work. What am I doing wrong? Ryan-- -- RyGuy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to delete 'tick' Character
Hi,
=code(a1) returns the ascii code of a character so identify your character with that. Mike "ryguy7272" wrote: A couple of days ago Gord Dibben gave me a macro to delete all 'hard returns'. The code is below: Sub Remove_CR_LF() With Selection .Replace What:=Chr(39), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False .Replace What:=Chr(146) & Chr(10), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False .Replace What:=Chr(180), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False End With End Sub The macro works great and I was trying to play with it to get it to delete all tick marks, which are those little characters that appear at the front of text, and some numbers, when you do a copy/paste special. I tried to identify the character by putting 1-256 in a column and referencing each cell with the =char() function. I wanted to find the appropriate identifier and then add it in the parentheses in: .Replace What:=Chr(39), I can't seem to find the identifier for these characters though. I thought it may be 39, 96, 145, or 146, but none of these seem to work. What am I doing wrong? Ryan-- -- RyGuy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to delete 'tick' Character
Excellent!!!
Thanks! Ryan-- "Mike H" wrote: Hi, =code(a1) returns the ascii code of a character so identify your character with that. Mike "ryguy7272" wrote: A couple of days ago Gord Dibben gave me a macro to delete all 'hard returns'. The code is below: Sub Remove_CR_LF() With Selection .Replace What:=Chr(39), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False .Replace What:=Chr(146) & Chr(10), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False .Replace What:=Chr(180), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False End With End Sub The macro works great and I was trying to play with it to get it to delete all tick marks, which are those little characters that appear at the front of text, and some numbers, when you do a copy/paste special. I tried to identify the character by putting 1-256 in a column and referencing each cell with the =char() function. I wanted to find the appropriate identifier and then add it in the parentheses in: .Replace What:=Chr(39), I can't seem to find the identifier for these characters though. I thought it may be 39, 96, 145, or 146, but none of these seem to work. What am I doing wrong? Ryan-- -- RyGuy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete everything after a certain character | Excel Programming | |||
Tick Box Macro | Excel Programming | |||
Excel Macro to edit and delete one character in a cell | Excel Programming | |||
unticking a tick box within a macro | Excel Programming | |||
Delete everything after a certain character? | Excel Programming |