Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Replacing characters

I have exported data from a database that looks like this in excel. .

BLN B172-ZNste
tc122  

I can't figure out how to take out the squares because I don't know what
they are. The file was exported to a .csv and this is what I get. Text to
column doesn't work nor does Find/Replace. What are these characters and
how can I eliminate or replace them.

Phil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Replacing characters

Hi Phil,

Try the following:

Public Sub ReplaceChr()

Dim rCell As Range
Dim rng As Range
Const ReplaceChr As Long = 29 '

Application.ScreenUpdating = False

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In ActiveSheet.UsedRange

rCell.Replace what:=Chr(ReplaceChr), _
Replacement:="", _
LookAt:=xlPart
Next
End If

Application.ScreenUpdating = False

End Sub

---
Regards,
Norman



"Phil Floyd" wrote in message
...
I have exported data from a database that looks like this in excel. .

BLN B172-ZNste
tc122  

I can't figure out how to take out the squares because I don't know what
they are. The file was exported to a .csv and this is what I get. Text
to column doesn't work nor does Find/Replace. What are these characters
and how can I eliminate or replace them.

Phil



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Replacing characters

Thanks Norman. You just saved me a ton of work.
Phil

"Norman Jones" wrote in message
...
Hi Phil,

Try the following:

Public Sub ReplaceChr()

Dim rCell As Range
Dim rng As Range
Const ReplaceChr As Long = 29 '

Application.ScreenUpdating = False

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In ActiveSheet.UsedRange

rCell.Replace what:=Chr(ReplaceChr), _
Replacement:="", _
LookAt:=xlPart
Next
End If

Application.ScreenUpdating = False

End Sub

---
Regards,
Norman



"Phil Floyd" wrote in message
...
I have exported data from a database that looks like this in excel. .

BLN B172-ZNste

tc122 


I can't figure out how to take out the squares because I don't know what
they are. The file was exported to a .csv and this is what I get. Text
to column doesn't work nor does Find/Replace. What are these characters
and how can I eliminate or replace them.

Phil





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
Replacing certain characters in a cell Mary Lou[_2_] Excel Worksheet Functions 3 March 5th 08 09:40 PM
Replacing ascii characters HappyCamper Excel Worksheet Functions 2 February 8th 06 07:10 PM
Replacing specific characters Trey Excel Discussion (Misc queries) 3 January 20th 06 11:57 PM
Replacing characters OhhAhh Excel Worksheet Functions 10 March 4th 05 12:28 AM
Replacing characters with leading zeroes Demian Valle Excel Programming 4 July 28th 04 07:07 PM


All times are GMT +1. The time now is 12:15 AM.

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

About Us

"It's about Microsoft Excel"