saurabh726 said:
Thanx A LOT YOGI AND jUST_jon
well both the fomulas are working if i edit the text string they dont work orginally
i have exported this file from a html which is based on java script does that makes any difference or something else..coz if i edit this string manually i mean spaces they work otherwise they are not working.
Please suggest what exactly the problem can be
Saurabh
You have CHAR(160) as leading characters.
In fact you need something different...
Sub TrimALL()
'David McRitchie 2000-07-03 mod 2000-08-16 join.htm
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim cell As Range
'Also Treat CHR 0160, as a space (CHR 032)
Selection.Replace What:=Chr(160), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
'Trim in Excel removes extra internal spaces, VBA does not
On Error Resume Next 'in case no text cells in selection
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlConstants, xlTextValues))
cell.Value = Application.Trim(cell.Value)
Next cell
On Error GoTo 0
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
To add it to your workbook:
Activate Tools|Macro|Visual Basic Editor;
Activate Insert|Module;
Copy the UDF above and paste it in the pane entitled "...(code)".
Activate File|Close and Return to Microsoft Excel.
I'll not comment on the array-formula that you missed to evaluate.