D
Dan E
I want to do a Trim on non-formula cells in specific columns. Currently the
Trim macro (which works, but is slow because of hitting all cells), looks
like this:-
Sub Trim_Text()
Dim cell As Range
On Error Resume Next
For Each cell In ActiveSheet.UsedRange
With cell
If .HasFormula = False Then
.Value = Application.WorksheetFunction.Trim(cell.Value)
End If
End With
Next cell
End Sub
and I want it to work only on cells in these columns
Range("B:B,E:E,H:H,K:K,N:N,Q:Q,T:T,Y:Y,AB:AB,AE:AE,AH:AH,AK:AK,AN:AN,AQ:AQ").
_
Select
Range("AQ2").Activate
(recorded using the macro recorder), but don't know how the new macro
should be written - all help and suggestions very gratefully received. And
if there's a way to use SpecialCells in the column range B:AQ, I'd like to
see how THAT might be done (columns C, D, F, G, I, J etc contain formulas,
and I want to work only on the columns between, which contain data that may
need trimming). I have looked at Dave McRitchie's TrimALL macro, but don't
understand the syntax etc. sufficiently to be confident in messing with it
TIA,
Dan
Trim macro (which works, but is slow because of hitting all cells), looks
like this:-
Sub Trim_Text()
Dim cell As Range
On Error Resume Next
For Each cell In ActiveSheet.UsedRange
With cell
If .HasFormula = False Then
.Value = Application.WorksheetFunction.Trim(cell.Value)
End If
End With
Next cell
End Sub
and I want it to work only on cells in these columns
Range("B:B,E:E,H:H,K:K,N:N,Q:Q,T:T,Y:Y,AB:AB,AE:AE,AH:AH,AK:AK,AN:AN,AQ:AQ").
_
Select
Range("AQ2").Activate
(recorded using the macro recorder), but don't know how the new macro
should be written - all help and suggestions very gratefully received. And
if there's a way to use SpecialCells in the column range B:AQ, I'd like to
see how THAT might be done (columns C, D, F, G, I, J etc contain formulas,
and I want to work only on the columns between, which contain data that may
need trimming). I have looked at Dave McRitchie's TrimALL macro, but don't
understand the syntax etc. sufficiently to be confident in messing with it
TIA,
Dan