LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DR DR is offline
external usenet poster
 
Posts: 1
Default Clean Macro that WORKS...

The Code below works to clean non-printing chars on the activesheet.
DR - 4GUnwired.com

'Macro to Clean special characters out of Excel Spreadsheets
Option Explicit

Public Sub CleanBeforeExportToText()
Dim NumRows As Long
Dim NumCols As Long
Dim i As Long
Dim j As Long
Dim strCell As String
Dim c As Range

ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Activate
NumRows = ActiveCell.Row
NumCols = ActiveCell.Column

For i = 1 To NumCols
For j = 1 To NumRows
'Cells(j, i).Activate 'Comment this out for speed
Set c = Cells(j, i)
strCell = Cells(j, i).Value
c.Value = Application.WorksheetFunction.Clean(strCell)
Next
Next

End Sub
 
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
Text Clean-up Macro RedFive Excel Discussion (Misc queries) 2 October 5th 09 03:00 PM
CLEAN function - macro?? George Applegate[_2_] Excel Worksheet Functions 2 September 15th 09 11:33 PM
Macro works Macro does not work Wanna Learn Excel Discussion (Misc queries) 4 March 24th 08 12:51 PM
Macro to clean up data diaare Excel Discussion (Misc queries) 8 October 25th 07 06:53 PM
macro works for some users and doesn't for others Pooja Excel Discussion (Misc queries) 2 October 27th 05 08:27 PM


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