Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default $ format in cell

Hey guys I had a code that did this but now I cant find
it!!!

What it does is as I type in a textbox it will put the $
sign in front of the number. So if I go to a textbox and
type 135, the dollar sign will be there at the front even
as I am typing.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default $ format in cell

Todd,

Here's one way


Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Static flag As Boolean

If flag < True Then
TextBox1.Text = "$" & TextBox1.Text
flag = True
End If

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
Hey guys I had a code that did this but now I cant find
it!!!

What it does is as I type in a textbox it will put the $
sign in front of the number. So if I go to a textbox and
type 135, the dollar sign will be there at the front even
as I am typing.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default $ format in cell

THat works, but thats a little longer than the other code
I had. Also this code works but if I then clear
everything out of the textbox and try typing another
number in there, it does not put the $ at the front.
-----Original Message-----
Todd,

Here's one way


Private Sub TextBox1_KeyPress(ByVal KeyAscii As

MSForms.ReturnInteger)
Static flag As Boolean

If flag < True Then
TextBox1.Text = "$" & TextBox1.Text
flag = True
End If

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Hey guys I had a code that did this but now I cant find
it!!!

What it does is as I type in a textbox it will put the $
sign in front of the number. So if I go to a textbox

and
type 135, the dollar sign will be there at the front

even
as I am typing.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default $ format in cell

Todd

Is this what you want?

Private Sub TextBox1_Enter()
TextBox1.Text = "$"
End Sub

Regards
Peter
-----Original Message-----
THat works, but thats a little longer than the other code
I had. Also this code works but if I then clear
everything out of the textbox and try typing another
number in there, it does not put the $ at the front.
-----Original Message-----
Todd,

Here's one way


Private Sub TextBox1_KeyPress(ByVal KeyAscii As

MSForms.ReturnInteger)
Static flag As Boolean

If flag < True Then
TextBox1.Text = "$" & TextBox1.Text
flag = True
End If

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine"

wrote in message
...
Hey guys I had a code that did this but now I cant find
it!!!

What it does is as I type in a textbox it will put the

$
sign in front of the number. So if I go to a textbox

and
type 135, the dollar sign will be there at the front

even
as I am typing.



.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default $ format in cell

Here you go:

Dim OneShot As Boolean

Private Sub TextBox1_Change()
If Application.EnableEvents = False Then Exit Sub
If Not OneShot Then
OneShot = True
Application.EnableEvents = False
TextBox1.Value = "$ " & TextBox1.Value
Application.EnableEvents = True
End If
End Sub


--

Julian Milano


"Todd Huttenstine" wrote in message
...
Hey guys I had a code that did this but now I cant find
it!!!

What it does is as I type in a textbox it will put the $
sign in front of the number. So if I go to a textbox and
type 135, the dollar sign will be there at the front even
as I am typing.





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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
cell format - remove cell format pattern without effecting colors Bas Excel Discussion (Misc queries) 1 March 23rd 09 02:54 PM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
how do i format a cell based on format of a range of cells? Chris Hardick Excel Discussion (Misc queries) 2 April 3rd 06 08:54 AM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM


All times are GMT +1. The time now is 05:37 PM.

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"