Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Manipulating Strings in a Macro

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Manipulating Strings in a Macro

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Len and InStr problem manipulating strings facmanboss Excel Programming 3 February 22nd 09 03:37 PM
Manipulating Strings Leslie Coover Excel Programming 2 July 27th 05 06:45 AM
Manipulating a data file with some sort of Macro taldridg2 Excel Programming 1 September 18th 04 04:13 AM
Manipulating 150+ checkboxes with a macro in Excel 2000 S. Romano Excel Programming 2 April 4th 04 08:37 PM
Manipulating 150+ checkboxes with a macro in Excel 2000 S. Romano Excel Programming 0 April 1st 04 05:45 PM


All times are GMT +1. The time now is 03:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"