From: Pas on
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?
From: Bob Phillips on
Shouldn't that be

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



--

HTH

Bob

"Pas" <Pas(a)discussions.microsoft.com> wrote in message
news:B704860F-51FE-42C5-B804-37B487086878(a)microsoft.com...
>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?


From: Gary''s Student on
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?
From: Pas on
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" <Pas(a)discussions.microsoft.com> wrote in message
> news:B704860F-51FE-42C5-B804-37B487086878(a)microsoft.com...
> >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?
>
>
> .
>
From: Dave Peterson on
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" <Pas(a)discussions.microsoft.com> wrote in message
> > news:B704860F-51FE-42C5-B804-37B487086878(a)microsoft.com...
> > >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
 |  Next  |  Last
Pages: 1 2
Prev: Creating a League table
Next: last negative cell