View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal[_2_] Robert Crandal[_2_] is offline
external usenet poster
 
Posts: 158
Default Right justify a string

"Claus Busch" wrote Hi Robert,

try:
s1 = "0000"
s2 = "13"
s2 = Format(CInt(s2), s1)
MsgBox s2


Hi Claus,

Thanks, that worked okay. But I overlooked a few situations.

Suppose that the s1 variable contains 4 space character (or ANY
characters, for that matter):

s1 = " " ' string with 4 spaces
s2 = "13"

Now, I would want s1 to look like:

s1 = " 13"

Do you have any ideas for this situation??