View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary Gary is offline
external usenet poster
 
Posts: 273
Default Replace leading zeros with leading spaces ?

I need Format because this is part of a loop building a dynamic Message Box
that has several columns; I need the columns to be aligned for readability.

Gary

"Ryan H" wrote:

I don't think you need to use Format.

So you want "12" to look like " 12"?

MyString = " 12"

But I know if can't be that simple. Is "12" a value in a cell? If so, use
this:

MyString = " " & Range("A1").Value
--
Cheers,
Ryan


"Gary" wrote:

I am using Excel 2007.
Format (12,000) gives me 012
I want (12,??0) to be 12 with a leading space

Question mark doesnt seem to work in Excel 2007