Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Accounting Format Text in a Textbox

I have a Textbox on a Userform that I want its text to be in an Accounting
Format when data is entered into it. This is an example of what I am trying
to do.

Private Sub Textbox1_AfterUpdate()
Textbox1.Value = Format(Textbox1, Accounting)
End Sub

I also retrieve cell values (that are formated as Accounting) into Textbox1
with my Worksheet Double Click Event. But it does not display the dollar
sign, why and how can I do this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

'autofills the user form with the data from global schedule worksheet
Cancel = True

With frmItemSummary
.Textbox1 = Cells(Target.Row, "A")
End With

End Sub
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Accounting Format Text in a Textbox

Maybe...

Private Sub Textbox1_AfterUpdate()
Dim AccountingFormat As String
AccountingFormat = "$* #,##0.00;$* (#,##0.00)"

Me.TextBox1.Value = Format(Me.TextBox1.Value, AccountingFormat)
End Sub


RyanH wrote:

I have a Textbox on a Userform that I want its text to be in an Accounting
Format when data is entered into it. This is an example of what I am trying
to do.

Private Sub Textbox1_AfterUpdate()
Textbox1.Value = Format(Textbox1, Accounting)
End Sub

I also retrieve cell values (that are formated as Accounting) into Textbox1
with my Worksheet Double Click Event. But it does not display the dollar
sign, why and how can I do this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

'autofills the user form with the data from global schedule worksheet
Cancel = True

With frmItemSummary
.Textbox1 = Cells(Target.Row, "A")
End With

End Sub
--
Cheers,
Ryan


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Accounting Format Text in a Textbox

When I load the cell value into Textbox1 when the userform is called it looks
just like a accounting format, plus if I don't change the text, when I click
my "Apply" button in applies the value to the cell just fine.

The problem happens when I change the Textbox1 value. I can only add a $
right next to the first number instead of it looking like it has a
"Accounting" format.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

frmItemSummary.Textbox1 = Cells(Target.Row, "A")
frmItemSummary.Show

End Sub

Private Sub btnApply_Click()
Sheets("Global Schedule").Cells(ActiveCell.Row, "A") = Textbox1
End Sub
--
Cheers,
Ryan


"Dave Peterson" wrote:

Maybe...

Private Sub Textbox1_AfterUpdate()
Dim AccountingFormat As String
AccountingFormat = "$* #,##0.00;$* (#,##0.00)"

Me.TextBox1.Value = Format(Me.TextBox1.Value, AccountingFormat)
End Sub


RyanH wrote:

I have a Textbox on a Userform that I want its text to be in an Accounting
Format when data is entered into it. This is an example of what I am trying
to do.

Private Sub Textbox1_AfterUpdate()
Textbox1.Value = Format(Textbox1, Accounting)
End Sub

I also retrieve cell values (that are formated as Accounting) into Textbox1
with my Worksheet Double Click Event. But it does not display the dollar
sign, why and how can I do this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

'autofills the user form with the data from global schedule worksheet
Cancel = True

With frmItemSummary
.Textbox1 = Cells(Target.Row, "A")
End With

End Sub
--
Cheers,
Ryan


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Accounting Format Text in a Textbox

You could just add as many space characters as you want:

Private Sub Textbox1_AfterUpdate()
Dim AccountingFormat As String
Dim HowManyCharacters As Long
Dim myStr As String

HowManyChars = 12
AccountingFormat = "#,##0.00;(#,##0.00)"

myStr = "$" & Right(Space(HowManyChars) _
& Format(Me.TextBox1.Value, AccountingFormat), HowManyChars)

Me.TextBox1.Value = myStr
End Sub



RyanH wrote:

When I load the cell value into Textbox1 when the userform is called it looks
just like a accounting format, plus if I don't change the text, when I click
my "Apply" button in applies the value to the cell just fine.

The problem happens when I change the Textbox1 value. I can only add a $
right next to the first number instead of it looking like it has a
"Accounting" format.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

frmItemSummary.Textbox1 = Cells(Target.Row, "A")
frmItemSummary.Show

End Sub

Private Sub btnApply_Click()
Sheets("Global Schedule").Cells(ActiveCell.Row, "A") = Textbox1
End Sub
--
Cheers,
Ryan

"Dave Peterson" wrote:

Maybe...

Private Sub Textbox1_AfterUpdate()
Dim AccountingFormat As String
AccountingFormat = "$* #,##0.00;$* (#,##0.00)"

Me.TextBox1.Value = Format(Me.TextBox1.Value, AccountingFormat)
End Sub


RyanH wrote:

I have a Textbox on a Userform that I want its text to be in an Accounting
Format when data is entered into it. This is an example of what I am trying
to do.

Private Sub Textbox1_AfterUpdate()
Textbox1.Value = Format(Textbox1, Accounting)
End Sub

I also retrieve cell values (that are formated as Accounting) into Textbox1
with my Worksheet Double Click Event. But it does not display the dollar
sign, why and how can I do this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

'autofills the user form with the data from global schedule worksheet
Cancel = True

With frmItemSummary
.Textbox1 = Cells(Target.Row, "A")
End With

End Sub
--
Cheers,
Ryan


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Accounting Format Text in a Textbox

I guess that will have to do. Thanks for the help!
--
Cheers,
Ryan


"Dave Peterson" wrote:

You could just add as many space characters as you want:

Private Sub Textbox1_AfterUpdate()
Dim AccountingFormat As String
Dim HowManyCharacters As Long
Dim myStr As String

HowManyChars = 12
AccountingFormat = "#,##0.00;(#,##0.00)"

myStr = "$" & Right(Space(HowManyChars) _
& Format(Me.TextBox1.Value, AccountingFormat), HowManyChars)

Me.TextBox1.Value = myStr
End Sub



RyanH wrote:

When I load the cell value into Textbox1 when the userform is called it looks
just like a accounting format, plus if I don't change the text, when I click
my "Apply" button in applies the value to the cell just fine.

The problem happens when I change the Textbox1 value. I can only add a $
right next to the first number instead of it looking like it has a
"Accounting" format.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

frmItemSummary.Textbox1 = Cells(Target.Row, "A")
frmItemSummary.Show

End Sub

Private Sub btnApply_Click()
Sheets("Global Schedule").Cells(ActiveCell.Row, "A") = Textbox1
End Sub
--
Cheers,
Ryan

"Dave Peterson" wrote:

Maybe...

Private Sub Textbox1_AfterUpdate()
Dim AccountingFormat As String
AccountingFormat = "$* #,##0.00;$* (#,##0.00)"

Me.TextBox1.Value = Format(Me.TextBox1.Value, AccountingFormat)
End Sub


RyanH wrote:

I have a Textbox on a Userform that I want its text to be in an Accounting
Format when data is entered into it. This is an example of what I am trying
to do.

Private Sub Textbox1_AfterUpdate()
Textbox1.Value = Format(Textbox1, Accounting)
End Sub

I also retrieve cell values (that are formated as Accounting) into Textbox1
with my Worksheet Double Click Event. But it does not display the dollar
sign, why and how can I do this?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

'autofills the user form with the data from global schedule worksheet
Cancel = True

With frmItemSummary
.Textbox1 = Cells(Target.Row, "A")
End With

End Sub
--
Cheers,
Ryan

--

Dave Peterson


--

Dave Peterson



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
Customize accounting format Rhett Excel Worksheet Functions 3 April 11th 10 03:55 AM
how to format text in textbox? ghost Excel Discussion (Misc queries) 1 May 18th 08 10:41 AM
Text box - Accounting Format Matts Excel Programming 0 September 6th 07 12:58 PM
Currency vs. Accounting Format zippy Excel Worksheet Functions 0 July 19th 06 02:59 AM
Format text in a textbox DB Excel Programming 3 February 9th 06 03:46 PM


All times are GMT +1. The time now is 07:03 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"