View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alpineman2 Alpineman2 is offline
external usenet poster
 
Posts: 18
Default 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.