Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Special characters in a string variable
Here's my abbreviated code:
Private Sub Worksheet_Change(ByVal Target As Range) For each cell in Target If cell.column = 1 and cell.row 1 Then ticker = CStr(UCase(Trim(cell.value))) Call LinkRef (ticker) End if Next cell End Sub Sub LinkRef(ticker) MsgBox ticker End Sub Of course the full procedure does more than display the message box. The problem I'm having is that if the value in the target cell begins with a special character, like $ or % as in $DJI or %GOOG, the sub routine does not seem to execute. I've tried removing the UCase(), Trim() and Cstr() to see if any of those could be the culprit, but no such luck. Any insight into what might be the cause here? Any solutions? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Special characters in a string variable
I tried you code and it works each time
ChasAA " wrote: Here's my abbreviated code: Private Sub Worksheet_Change(ByVal Target As Range) For each cell in Target If cell.column = 1 and cell.row 1 Then ticker = CStr(UCase(Trim(cell.value))) Call LinkRef (ticker) End if Next cell End Sub Sub LinkRef(ticker) MsgBox ticker End Sub Of course the full procedure does more than display the message box. The problem I'm having is that if the value in the target cell begins with a special character, like $ or % as in $DJI or %GOOG, the sub routine does not seem to execute. I've tried removing the UCase(), Trim() and Cstr() to see if any of those could be the culprit, but no such luck. Any insight into what might be the cause here? Any solutions? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert Leading Characters If String Is Only 7 Characters | Excel Discussion (Misc queries) | |||
How do I find a specific characters position in a string variable | Excel Programming | |||
Pass multiple characters to a string variable | Excel Programming | |||
String Function 'Like' and Special Characters | Excel Programming | |||
Escape for special characters in string | Excel Programming |