C
Compass Rose
I want to check if the last character in cell (i,2) of table 2 is a space and
delete it if it is. The coding I'm using is as follows:
Set Tbl = ActiveDocument.Tables(2)
For i = 2 To Tbl.Rows.Count
Tbl.Cell(i, 2).Select
Selection.EndKey Unit:=wdLine, Extend:=wdMove
LastChar = Asc(Selection.MoveLeft(Unit:=wdCharacter, Count:=1,
Extend:=wdExtend))
If LastChar = 32 Then Selection.Delete
Next i
LastChar always equals 49, regardless of what the last character is. Where
have I gone wrong?
TIA
David
delete it if it is. The coding I'm using is as follows:
Set Tbl = ActiveDocument.Tables(2)
For i = 2 To Tbl.Rows.Count
Tbl.Cell(i, 2).Select
Selection.EndKey Unit:=wdLine, Extend:=wdMove
LastChar = Asc(Selection.MoveLeft(Unit:=wdCharacter, Count:=1,
Extend:=wdExtend))
If LastChar = 32 Then Selection.Delete
Next i
LastChar always equals 49, regardless of what the last character is. Where
have I gone wrong?
TIA
David