View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Greg[_41_] Greg[_41_] is offline
external usenet poster
 
Posts: 8
Default Manipulating Strings in a Macro

Mike,
Thank you! What I didn't know about was MID , Left, and Chr.
Greg

"Mike H" wrote in message
...
Hi,

You could mofify this. Note i've used MID to return everyting from the
variable CONTENT starting at position 2

content = Range("A1").Value
If Left(content, 1) = Chr(127) Then
Range("A1").Value = Mid(content, 2)
End If

Mike

"Greg" wrote:

I am attempting to remove a character from a cell by using a macro with

some
VB coding. The cell contains a "special" character in the first

position.
The character appears similar to a "bullet" in a word document. The rest

of
the cell contains numeric characters. My questions are 1. How do I

determine
if the character is present in the cell and 2. how do I remove it,

replacing
it with a space character or triming the character from the

Cell/Variable.

If I look at a the spreadsheet I can manually detect and Remove/Replace

the
character.

The way I do it is :

=If (CODE(A1)127, TRIM(REPLACE(A1,1," ")),A1)

In my macro I have the contents of the cell to be reviewed in a variable
labeled CONTENT .

Thank You in advance for your suggestions.

Greg