G Guest Nov 2, 2007 #1 Hi guys/Girls Is there a way to apply the CLEAN function to an entire worksheet?
B Bob Phillips Nov 2, 2007 #2 Public Sub Test() Dim cell As Range For Each cell In ActiveSheet.UsedRange If Not cell.HasFormula Then cell.Value = Application.Clean(cell.Value) End If Next cell End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy)
Public Sub Test() Dim cell As Range For Each cell In ActiveSheet.UsedRange If Not cell.HasFormula Then cell.Value = Application.Clean(cell.Value) End If Next cell End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy)
G Guest Nov 2, 2007 #3 Select the cells you want to clean and run: Sub doit() For Each r In Selection If Application.WorksheetFunction.IsText(r) Then r.Value = Application.WorksheetFunction.Clean(r.Value) End If Next End Sub
Select the cells you want to clean and run: Sub doit() For Each r In Selection If Application.WorksheetFunction.IsText(r) Then r.Value = Application.WorksheetFunction.Clean(r.Value) End If Next End Sub