Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default #Holding values in different format#

Hi,

A 16 digit number is to be entered into a vbform textbox,
on leaving or pressing enter, I would like this number:

e.g abcdefghijklmnop

to be displyed in this format:

abcd efgh ijkl mnop

Can anyone help?

Thanks

Dean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default #Holding values in different format#

did you try just formatting the cell?
like "### ### ###" for example

if its a text string that you need rather than leaving
the data as a number, then you could use someting like
txt = textbox1.text
MyText = left(txt,4) & " " & mid(txt,5,4) & " "
MyText =MyText & mid(txt,9,4) & " " & right(txt,4)


Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Hi,

A 16 digit number is to be entered into a vbform

textbox,
on leaving or pressing enter, I would like this number:

e.g abcdefghijklmnop

to be displyed in this format:

abcd efgh ijkl mnop

Can anyone help?

Thanks

Dean
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default #Holding values in different format#

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Left(TextBox1, 4) & " " & Mid(TextBox1, 5, 4) & " " _
& Mid(TextBox1, 9, 4) & " " & Mid(TextBox1, 13, 4)
End Sub

Any characters over 16 will be dropped.

--

Vasant




"Dean Knox" wrote in message
...
Hi,

A 16 digit number is to be entered into a vbform textbox,
on leaving or pressing enter, I would like this number:

e.g abcdefghijklmnop

to be displyed in this format:

abcd efgh ijkl mnop

Can anyone help?

Thanks

Dean



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Indirect formulas in cells not holding cell format after copy Cathy[_3_] Excel Worksheet Functions 3 March 21st 10 05:39 AM
Concatenate numbers and text while holding a custom number format. jpowell111 Excel Worksheet Functions 9 February 10th 10 11:22 PM
holding the result constant [email protected] Excel Worksheet Functions 1 July 14th 06 11:46 PM
holding a value after first calcuation spence Excel Worksheet Functions 2 March 27th 06 12:54 AM
Cells not holding format Aurora Excel Discussion (Misc queries) 0 March 9th 05 07:11 PM


All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"