#1   Report Post  
Posted to microsoft.public.excel.misc
PAS PAS is offline
external usenet poster
 
Posts: 26
Default TextBox format?

I am trying to format a textbox and I'm using to following code:

Private Sub TextBox1_Change
TextBox1.Value = Format (TextBox1.Value, "###0")
End Sub

But nothing happens......Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 834
Default TextBox format?

Shouldn't that be

Private Sub TextBox1_Change()
TextBox1.Value = Format(TextBox1.Value, "#,##0")
End Sub



--

HTH

Bob

"Pas" wrote in message
...
I am trying to format a textbox and I'm using to following code:

Private Sub TextBox1_Change
TextBox1.Value = Format (TextBox1.Value, "###0")
End Sub

But nothing happens......Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.misc
PAS PAS is offline
external usenet poster
 
Posts: 26
Default TextBox format?

Thanks guys, but I get a message as follows:
Can't find project or library. with Format highlighted

"Bob Phillips" wrote:

Shouldn't that be

Private Sub TextBox1_Change()
TextBox1.Value = Format(TextBox1.Value, "#,##0")
End Sub



--

HTH

Bob

"Pas" wrote in message
...
I am trying to format a textbox and I'm using to following code:

Private Sub TextBox1_Change
TextBox1.Value = Format (TextBox1.Value, "###0")
End Sub

But nothing happens......Any ideas?



.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default TextBox format?

This is built into excel's VBA. It should not cause an error.

So if you're getting an error message on that statement, it usually means that
you have an invalid reference in that workbook's project.

Open excel and your workbook
Open the VBE and select your workbook's project.
Then click on: Tools|References
Look for MISSING reference.

Uncheck that missing reference.

The missing reference may not (usually doesn't) have anything to do with the
line that caused the error.


Pas wrote:

Thanks guys, but I get a message as follows:
Can't find project or library. with Format highlighted

"Bob Phillips" wrote:

Shouldn't that be

Private Sub TextBox1_Change()
TextBox1.Value = Format(TextBox1.Value, "#,##0")
End Sub



--

HTH

Bob

"Pas" wrote in message
...
I am trying to format a textbox and I'm using to following code:

Private Sub TextBox1_Change
TextBox1.Value = Format (TextBox1.Value, "###0")
End Sub

But nothing happens......Any ideas?



.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
PAS PAS is offline
external usenet poster
 
Posts: 26
Default TextBox format?

Thanks Dave that works well now.


"Dave Peterson" wrote:

This is built into excel's VBA. It should not cause an error.

So if you're getting an error message on that statement, it usually means that
you have an invalid reference in that workbook's project.

Open excel and your workbook
Open the VBE and select your workbook's project.
Then click on: Tools|References
Look for MISSING reference.

Uncheck that missing reference.

The missing reference may not (usually doesn't) have anything to do with the
line that caused the error.


Pas wrote:

Thanks guys, but I get a message as follows:
Can't find project or library. with Format highlighted

"Bob Phillips" wrote:

Shouldn't that be

Private Sub TextBox1_Change()
TextBox1.Value = Format(TextBox1.Value, "#,##0")
End Sub



--

HTH

Bob

"Pas" wrote in message
...
I am trying to format a textbox and I'm using to following code:

Private Sub TextBox1_Change
TextBox1.Value = Format (TextBox1.Value, "###0")
End Sub

But nothing happens......Any ideas?


.


--

Dave Peterson
.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default TextBox format?

If your textbox contains 35, the following:

Sub dural()
Dim i As Integer, s As String
ActiveSheet.Shapes("Text Box 1").Select
With Selection.Characters
s = Selection.Characters.Text
i = CInt(s)
s = Format(i, "xxx0")
.Text = s
End With
End Sub


will update to:
xxx35
--
Gary''s Student - gsnu201001


"Pas" wrote:

I am trying to format a textbox and I'm using to following code:

Private Sub TextBox1_Change
TextBox1.Value = Format (TextBox1.Value, "###0")
End Sub

But nothing happens......Any ideas?

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
how to format text in textbox? ghost Excel Discussion (Misc queries) 1 May 18th 08 10:41 AM
TextBox format? AOU Excel Discussion (Misc queries) 4 June 12th 07 11:24 PM
Textbox date format. AOU Excel Discussion (Misc queries) 2 April 24th 07 02:28 PM
TextBox Format grahammal Excel Discussion (Misc queries) 3 March 29th 06 01:35 PM
Format numbers in Textbox stickandrock Excel Discussion (Misc queries) 1 October 4th 05 08:41 PM


All times are GMT +1. The time now is 05:50 AM.

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

About Us

"It's about Microsoft Excel"