Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dirk,
Try this. It allows the user to select the range with the mouse Set rng = Application.Inputbox("Please select the mouse", Type:=8) For Each cell in rng cell.Value = Trim(cell.Value) Next cell -- HTH RP (remove nothere from the email address if mailing direct) "Dirk" wrote in message oups.com... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting blanks | Excel Discussion (Misc queries) | |||
MACRO HELP - deleting rows containing a range of blank cells | Excel Discussion (Misc queries) | |||
copy range of cells with blanks then paste without blanks | Excel Worksheet Functions | |||
Deleting blanks from the end of values in cells | Excel Programming | |||
Deleting blanks from the end of values in cells | Excel Programming |