A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

TextBox format?



 
 
Thread Tools Display Modes
  #1  
Old April 25th, 2010, 07:06 PM posted to microsoft.public.excel.misc
PAS
external usenet poster
 
Posts: 34
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  
Old April 25th, 2010, 07:44 PM posted to microsoft.public.excel.misc
Bob Phillips[_3_]
external usenet poster
 
Posts: 489
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  
Old April 25th, 2010, 08:10 PM posted to microsoft.public.excel.misc
Gary''s Student
external usenet poster
 
Posts: 7,584
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?

  #4  
Old April 25th, 2010, 09:19 PM posted to microsoft.public.excel.misc
PAS
external usenet poster
 
Posts: 34
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?



.

  #5  
Old April 25th, 2010, 09:45 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
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
  #6  
Old April 25th, 2010, 11:13 PM posted to microsoft.public.excel.misc
PAS
external usenet poster
 
Posts: 34
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
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:33 AM.


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