![]() |
Adding spaces into a variable
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 |
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 |
Adding spaces into a variable
Bob,
You are right, it is a string. Thanks for the code but it is still not working. I am not sure what it is, can you help? Thanks, Peter |
Adding spaces into a variable
Is your textbox on a userform?
Describe how it is not working please. -- --- HTH Bob (change the xxxx to gmail if mailing direct) "Peter" wrote in message oups.com... Bob, You are right, it is a string. Thanks for the code but it is still not working. I am not sure what it is, can you help? Thanks, Peter |
Adding spaces into a variable
Thanks for your help, it works fine now.
The code helped a lot! |
All times are GMT +1. The time now is 01:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com