ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pLeAsE hELp! format function in excel visual basic editor (https://www.excelbanter.com/excel-programming/402051-please-help-format-function-excel-visual-basic-editor.html)

Alpineman2

pLeAsE hELp! format function in excel visual basic editor
 
How do I format a textbox ([Input Textbox] & [Sum (locked) Textbox]) within a
Userform in the following formats:
Numeric - such as ###,###,###.## (using 1000 separator [,])
Currency
Accounting
Percentage
Date

Note: I am a newbie, if someone would explain the function and where I would
implement such. I would greatly appreciate any guidance.



joel

pLeAsE hELp! format function in excel visual basic editor
 
You need to convert the number to a string using the format function. the
format parameter is the same as the worksheet formats that you can look at in
the menu
Format - Cells - Number. for example

mystring = format(mynumber,"general")
mystring = format(mynumber,"#0")
mystring = format(mydate,"mm-yyyyl")
mystring = format(mynumber,"###,###,###.##l")


"Alpineman2" wrote:

How do I format a textbox ([Input Textbox] & [Sum (locked) Textbox]) within a
Userform in the following formats:
Numeric - such as ###,###,###.## (using 1000 separator [,])
Currency
Accounting
Percentage
Date

Note: I am a newbie, if someone would explain the function and where I would
implement such. I would greatly appreciate any guidance.



Alpineman2

pLeAsE hELp! format function in excel visual basic editor
 
Hi Joel,

Thank you, but I don't quite understand one thing. Where I place "mystring
= format" code?
Below is an example of what I am trying to accomplish:
Private Sub CommandButton1_Click()
TextBox4.Text = (TextBox1.Text / 43560)
End Sub

I do very much appreciate your help.
Thank you,

J.Brice

"Joel" wrote:

You need to convert the number to a string using the format function. the
format parameter is the same as the worksheet formats that you can look at in
the menu
Format - Cells - Number. for example

mystring = format(mynumber,"general")
mystring = format(mynumber,"#0")
mystring = format(mydate,"mm-yyyyl")
mystring = format(mynumber,"###,###,###.##l")


"Alpineman2" wrote:

How do I format a textbox ([Input Textbox] & [Sum (locked) Textbox]) within a
Userform in the following formats:
Numeric - such as ###,###,###.## (using 1000 separator [,])
Currency
Accounting
Percentage
Date

Note: I am a newbie, if someone would explain the function and where I would
implement such. I would greatly appreciate any guidance.



joel

pLeAsE hELp! format function in excel visual basic editor
 
It looks like your have to go from text to numberic back to text. I'm going
to use an intemediate variable, but it is not necessary

Private Sub CommandButton1_Click()
numbervalue = val(TextBox1.Text) / 43560# 'convert to number
TextBox4.Text = format(numbervalue,"###,###,###.##")
End Sub


"Alpineman2" wrote:

Hi Joel,

Thank you, but I don't quite understand one thing. Where I place "mystring
= format" code?
Below is an example of what I am trying to accomplish:
Private Sub CommandButton1_Click()
TextBox4.Text = (TextBox1.Text / 43560)
End Sub

I do very much appreciate your help.
Thank you,

J.Brice

"Joel" wrote:

You need to convert the number to a string using the format function. the
format parameter is the same as the worksheet formats that you can look at in
the menu
Format - Cells - Number. for example

mystring = format(mynumber,"general")
mystring = format(mynumber,"#0")
mystring = format(mydate,"mm-yyyyl")
mystring = format(mynumber,"###,###,###.##l")


"Alpineman2" wrote:

How do I format a textbox ([Input Textbox] & [Sum (locked) Textbox]) within a
Userform in the following formats:
Numeric - such as ###,###,###.## (using 1000 separator [,])
Currency
Accounting
Percentage
Date

Note: I am a newbie, if someone would explain the function and where I would
implement such. I would greatly appreciate any guidance.



Alpineman2

pLeAsE hELp! format function in excel visual basic editor
 
Joel,

It worked!! Thank you very much.

J.Brice

"Joel" wrote:

It looks like your have to go from text to numberic back to text. I'm going
to use an intemediate variable, but it is not necessary

Private Sub CommandButton1_Click()
numbervalue = val(TextBox1.Text) / 43560# 'convert to number
TextBox4.Text = format(numbervalue,"###,###,###.##")
End Sub


"Alpineman2" wrote:

Hi Joel,

Thank you, but I don't quite understand one thing. Where I place "mystring
= format" code?
Below is an example of what I am trying to accomplish:
Private Sub CommandButton1_Click()
TextBox4.Text = (TextBox1.Text / 43560)
End Sub

I do very much appreciate your help.
Thank you,

J.Brice

"Joel" wrote:

You need to convert the number to a string using the format function. the
format parameter is the same as the worksheet formats that you can look at in
the menu
Format - Cells - Number. for example

mystring = format(mynumber,"general")
mystring = format(mynumber,"#0")
mystring = format(mydate,"mm-yyyyl")
mystring = format(mynumber,"###,###,###.##l")


"Alpineman2" wrote:

How do I format a textbox ([Input Textbox] & [Sum (locked) Textbox]) within a
Userform in the following formats:
Numeric - such as ###,###,###.## (using 1000 separator [,])
Currency
Accounting
Percentage
Date

Note: I am a newbie, if someone would explain the function and where I would
implement such. I would greatly appreciate any guidance.




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com