LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro for deleting non-printable characters from EXCEL

I Have written the function below to remove some non printable characters
from my WORKBOOK.
However when I run the code it delete all entries from my worksheets.

Sub Clean()
Dim j As Integer
Dim vAddText

Application.DisplayAlerts = False
Application.StatusBar = "Starting cleaning of workbook " &
Application.ActiveWorkbook.FullName
On Error GoTo 0
vAddText = Array(Chr(129), Chr(141), Chr(143), Chr(144), Chr(157))
For J = 1 To 31
If J < 10 Then Cells.Replace What:=Chr(J), Replacement:="",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
For J = 0 To UBound(vAddText)
Cells.Replace What:=vAddText(J), Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
Application.StatusBar = "Ending cleaning of workbook " &
Application.ActiveWorkbook.FullName
Application.DisplayAlerts = True
End Sub

--
George, Southampton, UK
 
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
Checking characters , non-printable etc. dhstein Excel Discussion (Misc queries) 1 February 25th 10 11:57 PM
Search and replace for non printable characters ricl999 Excel Programming 5 February 27th 09 08:32 PM
Replace non printable characters TonyL Excel Worksheet Functions 4 August 25th 07 01:03 PM
Viewing non-printable characters refresh Excel Discussion (Misc queries) 1 July 21st 06 02:25 PM
Replacing Non Printable Characters SA3214 Excel Programming 2 October 15th 05 12:24 PM


All times are GMT +1. The time now is 05:28 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"