Question : VBA code to clean all cells in all worksheets from non-printable characters

Please review the below VBA code and advise me to why it is not working (it does nothing!). Urgent. Thanks, C:)

'Remove all non-printable characters from all cells in all
'Worksheets of a Workbook

Sub RemoveNonPrintableChars()
    Dim sht As Worksheet
    Dim data As String
    Dim i, j, cc, rc As Integer
   
    For Each sht In ActiveWorkbook.Worksheets
      cc = UsedRange.Columns.Count
      rc = UsedRange.Rows.Count
           
      For i = 1 To i = cc
       For j = 1 To j = rc
            data = sht.Cells(j, i).Value
        Application.WorksheetFunction.Clean (data)
        sht.Cells(j, i).Value = data
       Next j
      Next i
    Next sht
End Sub

Answer : VBA code to clean all cells in all worksheets from non-printable characters

give this a go  

For i = 1 To cc
       For j = 1 To rc
            data = sht.Cells(j, i).Value
        Application.WorksheetFunction.Clean (data)
        sht.Cells(j, i).Value = data
       Next j
      Next i
Random Solutions  
 
programming4us programming4us