View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
CB CB is offline
external usenet poster
 
Posts: 97
Default Eliminating commas if they are first characters in a string

Hmm, I tried dmoney's code but it did not work, I'm at a loss as of right
now...

"Rick Rothstein (MVP - VB)" wrote:

While is an older non-For...Next loop construct and its loop "ender" is the
Wend statement. I think the 'end' part of Wend is meant to indicate "the end
of the loop" and the 'W' in front of it is supposed to link it to the
"While" statement (While-end...Wend). While a lot of people still use
While...Wend constructions, many now use Do While...Loop constructions
instead. Since, as Gary"s Student used it, the loop either executes once or
it doesn't execute at all, I think a simple If...Then block would be a
clearer way to implement this.

Rick


"CB" wrote in message
...
Thanks everyone for the quick responces!

Gary"s Student could you explain to me what this part of the code is
doing?

cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Wend

I have not seen Wend before...



"Gary''s Student" wrote:

Sub ahhhhhhhh()

For Each cell In Range("H59:H60")
While Left(cell.Value, 1) = ","
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Wend
Next

End Sub

--
Gary''s Student - gsnu200800