Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Adding leading zeroes to selected alphanumeric cells

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format cells in web query (leading zeroes) Kathy Excel Discussion (Misc queries) 5 October 2nd 07 02:26 PM
Leading Zeroes Melissa Excel Discussion (Misc queries) 3 October 11th 06 07:38 PM
Leading Zeroes Ken Excel Discussion (Misc queries) 1 October 7th 05 03:17 PM
CSV leading zeroes Tim_nol Excel Discussion (Misc queries) 2 December 28th 04 08:19 PM
How do I format data cells in Excel to keep leading zeroes? LennyD Setting up and Configuration of Excel 2 December 15th 04 10:42 PM


All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"