View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Adding spaces into a variable

Peter,

If you want to embed spaces, it can't go into a Long variable, it will have
to be a String.

With Me.TextBox1
sVar = Format(.text,"0000 0000 0000 0000"))
End With
--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Peter" wrote in message
ups.com...
I have a problem!

I am writing a macro where the user pastes in a 16 digit number into a
text box on a user form.
This then becomes a variable (long).

I need the macro to edit this variable by placing a space after the
4th, 8th and 12th number.

ie, from this: ################ to this: #### #### #### ####.

Is this possible?

Thanks,

Peter