View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Insert leading zero's

Somthing like the below

Dim intOld as Integer, intNew As Integer

intOld = 43
intNew = IIf(intOld < 100, intOld * 10 ^ (3 - Len(intOld)), intOld)

If this post helps click Yes
---------------
Jacob Skaria


"art" wrote:

Hello:

I would like to use a code that will do the following:

If I enter in Range(ABC...) 1 or 2 digits, then it should be followed with
two zero's, and if its more than 2 digits then leave it as is. So if I enter
4, it should turn it to 400 and if I enter 435 it should leave it like that.

Thanks so Much.

Art