D列に「+」と「-」があるすべてのセルを削除したい。次のマクロを試してみましたが、うまくいくと思いましたが、何も起こりません。
Sub doWhile4()
'Replace blank spaces with underscores in a Range of Cells, using VBA loops; or 'Remove
blank spaces in a Range of Cells, using VBA loops.
Dim iCell As Range
Dim textString As String
Dim n As Integer
'iCell is a Cell in the specified Range which contains the textString
'textString is the text in a Cell in which blank spaces are to be replaced with
'underscores. n is the position of blank space(s) occurring in a textString
For Each iCell In ActiveSheet.Range("D2:D34")
textString = iCell
n = InStr(textString, "+")
'The VBA InStr function returns the position of the first occurrence of a string within
'another string. Using this to determine the position of the first blank space in the
'textString.
Do While n > 0
textString = Left(textString, n - 1) & Right(textString, Len(textString) - n)
'This line of code is to remove all blank spaces in the
'textString
n = InStr(textString, "+")
Loop
iCell = textString
Next
End Sub
私は何を間違っていますか?