Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Simple formatting question

I have a UserForm with a textbox and I want to take the input value, format
it so two decimal places show at all times. Below is the line of code I am
working with. If I input 100 into the textbox, the value in the cell shows as
100. It doesn't make any difference if it is currency with no $ or a number
with two decimal places.

ActiveCell.Value = Val(Format(Me.txtOrigPrice, "Standard"))

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Simple formatting question

When you put the data into the worksheet it is going to use the formating of
the cell in the worksheet. You need to also change the formating in the
activecell

ActiveCell.Value = Val(Format(Me.txtOrigPrice, "Standard"))
ActiveCell.NumberFormat = "0.00"

"Billy B" wrote:

I have a UserForm with a textbox and I want to take the input value, format
it so two decimal places show at all times. Below is the line of code I am
working with. If I input 100 into the textbox, the value in the cell shows as
100. It doesn't make any difference if it is currency with no $ or a number
with two decimal places.

ActiveCell.Value = Val(Format(Me.txtOrigPrice, "Standard"))

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Simple formatting question

Dear Billy

ActiveCell.Value = Format(Val(Me.txtOrigPrice)),"0.00")
OR
ActiveCell.Value = Worksheetfunction.Round(Val(Me.txtOrigPrice)),2)


If this post helps click Yes
---------------
Jacob Skaria


"Billy B" wrote:

I have a UserForm with a textbox and I want to take the input value, format
it so two decimal places show at all times. Below is the line of code I am
working with. If I input 100 into the textbox, the value in the cell shows as
100. It doesn't make any difference if it is currency with no $ or a number
with two decimal places.

ActiveCell.Value = Val(Format(Me.txtOrigPrice, "Standard"))

Thank you.

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
Very Simple formatting Question Quin Excel Discussion (Misc queries) 4 December 7th 08 03:41 PM
Simple formatting question.... huruta Excel Discussion (Misc queries) 1 April 26th 06 08:18 PM
Conditional formatting, simple question... Kelly Excel Worksheet Functions 2 March 1st 06 07:31 PM
Conditional formatting--simple question John Wirt Excel Worksheet Functions 4 February 5th 06 07:13 PM
Simple? Formatting Question John Baker Excel Programming 6 January 17th 05 09:05 AM


All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"