PC Review


Reply
Thread Tools Rate Thread

Adding leading zeroes to selected alphanumeric cells

 
 
TheObstacleIsThePath@gmail.com
Guest
Posts: n/a
 
      26th Sep 2007
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.

 
Reply With Quote
 
 
 
 
TheObstacleIsThePath@gmail.com
Guest
Posts: n/a
 
      26th Sep 2007
On Sep 26, 11:01 am, "TheObstacleIsTheP...@gmail.com"
<TheObstacleIsTheP...@gmail.com> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format cells in web query (leading zeroes) =?Utf-8?B?S2F0aHk=?= Microsoft Excel Misc 5 2nd Oct 2007 02:26 PM
Leading Zeroes =?Utf-8?B?bWVsaXNzYQ==?= Microsoft Excel Misc 3 11th Oct 2006 07:38 PM
Leading Zeroes =?Utf-8?B?S2Vu?= Microsoft Excel Misc 1 7th Oct 2005 03:17 PM
How do I format data cells in Excel to keep leading zeroes? =?Utf-8?B?TGVubnlE?= Microsoft Excel Setup 2 15th Dec 2004 10:42 PM
Adding Leading Zeroes to Text Chris Microsoft Access Queries 1 15th Oct 2003 04:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:41 AM.