View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dirk[_4_] Dirk[_4_] is offline
external usenet poster
 
Posts: 6
Default macro over range, deleting blanks

Dear all

I want to delete blanks at the end over a range of strings. I wrote the
following macro but I am not sure about the right usage of rng. help
would be appreciated.

Sub delblanks()
Dim count As Integer, rng As range
rng = InputBox("Please type the range")
count = 0
range(rng).Select
Do While Right(rng, 1) = " "
count = count + 1
rng = Left(rng, Len(rng) - 1)
Loop
MsgBox ("there were " + count + " changes made")
End Sub

Dirk