Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Removing unwanted characters

Try this routine

Public Sub Strip_Pick()
Dim myRange As Range
Dim Cell As Range
Dim myStr As String
Dim i As Integer
With Application
.ScreenUpdating = False
.Calculation = xlManual
End With
On Error Resume Next
Set myRange = Range(ActiveCell.Address & _
"," & Selection.Address) _
.SpecialCells(xlCellTypeConstants)
If myRange Is Nothing Then Exit Sub
If Not myRange Is Nothing Then
For Each Cell In myRange
myStr = Cell.Text
For i = 1 To Len(myStr)
If Not (Mid(myStr, i, 1)) Like "[0-9a-zA-Z]" Then
myStr = Left(myStr, i - 1) & " " & Mid(myStr, i + 1)
End If
Next i
Cell.Value = Application.Trim(myStr)
Next Cell
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End If
End Sub


Gord

On Mon, 5 Dec 2005 11:45:16 -0600, Scorpvin
wrote:


Gord,
I'm not very familiar with VB. How do I get a space to replace the
unwanted character in your statement?

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
removing pre-set characters from comments Matt G. Excel Worksheet Functions 3 November 15th 05 11:12 PM
Removing Non-Numeric Characters GlenS Excel Discussion (Misc queries) 5 October 12th 05 10:50 AM
Removing text characters Scott Excel Worksheet Functions 4 August 11th 05 12:19 PM
Removing blank characters ? bvinternet Excel Discussion (Misc queries) 2 July 24th 05 09:15 AM
removing some of the characters from a cell Patience Excel Discussion (Misc queries) 2 May 3rd 05 08:28 PM


All times are GMT +1. The time now is 06:23 AM.

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"