N
Neeru
Hi,
I am using a procedure in my Macro that trims all the
spaces(special characters like chr 160).The procedure is
as shown below. The problem here is one of the users of
this function uses Japanese operating system(She can view
all the properties in the toolbar of Excel in Japanese).
When she runs this procedure on her system, the trim
function doesn't remove these special characters. What do
i do to solve this problem??
Sub TrimRows()
Workbooks(Macrotemp).Activate
Dim ptotsht, shtn, name_S
ptotsht = Sheets.Count
shtn = 1
Do While shtn <= ptotsht
name_S = Sheets(shtn).Name
Workbooks(Macrotemp).Worksheets(name_S).Activate
Dim l_r
Application.Calculation = xlCalculationManual
l_r = LastCell(Sheets(name_S)).Row
Range("A2:F" & l_r).Select
Dim cell As Range
Selection.Replace What:=Chr(160), Replacement:=Chr
(32), _
LookAt:=xlPart, SearchOrder:=xlByRows,
MatchCase:=False
On Error Resume Next
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
Range("A1").Select
shtn = shtn + 1
Loop
End Sub
Could someone please help!! I Appreciate any help in
Advance.
Thanks,
Neeru.
I am using a procedure in my Macro that trims all the
spaces(special characters like chr 160).The procedure is
as shown below. The problem here is one of the users of
this function uses Japanese operating system(She can view
all the properties in the toolbar of Excel in Japanese).
When she runs this procedure on her system, the trim
function doesn't remove these special characters. What do
i do to solve this problem??
Sub TrimRows()
Workbooks(Macrotemp).Activate
Dim ptotsht, shtn, name_S
ptotsht = Sheets.Count
shtn = 1
Do While shtn <= ptotsht
name_S = Sheets(shtn).Name
Workbooks(Macrotemp).Worksheets(name_S).Activate
Dim l_r
Application.Calculation = xlCalculationManual
l_r = LastCell(Sheets(name_S)).Row
Range("A2:F" & l_r).Select
Dim cell As Range
Selection.Replace What:=Chr(160), Replacement:=Chr
(32), _
LookAt:=xlPart, SearchOrder:=xlByRows,
MatchCase:=False
On Error Resume Next
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
Range("A1").Select
shtn = shtn + 1
Loop
End Sub
Could someone please help!! I Appreciate any help in
Advance.
Thanks,
Neeru.