View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] TheObstacleIsThePath@gmail.com is offline
external usenet poster
 
Posts: 17
Default Adding leading zeroes to selected alphanumeric cells

On Sep 26, 11:01 am, "
wrote:
Can anyone tell me why this only works on the FIRST cell of a
selection rather than ALL selected cells?

Sub fixID()
For Each rng In Selection
rng.NumberFormat = "@"
rng.Value = Right("000000" & rng.Value, 6)
Exit Sub
Next
End Sub

Pardon my ignorance.


nevermind: I read my post and saw the "exit sub" --oops