userform number formatting

Hi,
having entered a number into a textbox in a userform how does one then
format it to have 2 decimal places?
its not too important as they are formatted in the cells they end up entered
into, it would just make it easier on the eye.

Rick


0
1/2/2004 9:14:08 PM
excel 39879 articles. 2 followers. Follow

1 Replies
698 Views

Similar Articles

[PageSpeed] 33

Tom Ogilvy just posted this for someone else.  It does a little more than you
ask, but may be what you want <bg>.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
   If IsNumeric(TextBox1.Value) Then
     If Len(Trim(TextBox1.Value)) = 1 Then
       TextBox1.Value = Format(CLng(TextBox1.Value), "0000")
     Else
        MsgBox "Single Digit Numbers only"
        TextBox1.Value = ""
         Cancel = True
     End If
   Else
     MsgBox "Entry must be numeric and single digit"
     TextBox1.Value = ""
      Cancel = True
   End If
End Sub

But you can see that the Format() stuff is the part that does the, er,
formatting.

Rick Sanderson wrote:
> 
> Hi,
> having entered a number into a textbox in a userform how does one then
> format it to have 2 decimal places?
> its not too important as they are formatted in the cells they end up entered
> into, it would just make it easier on the eye.
> 
> Rick

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
1/2/2004 11:16:46 PM
Reply:

Similar Artilces:

format problem #4
I have a file of 50000 rows and in column A in just 2 or three cells i have a cell which show #NAME? but if u click that cell it will sho =- vikram, how to get rid of this cell...i mean to say that how t format that cell to a eadable format thank -- Message posted from http://www.ExcelForum.com Nothing wrong with the format (at least I don't think so), you just don't have a named range or value of vikram. -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 97/00/02/03 ------------------------------------------------...

Format and layout protection
can I format a publisher document so people can alter the text, but leave the formatting and layout alone? No. If they can edit anything, they can edit anything. If you think about it, consider what would happen if in editing the text, they needed a larger text box? -- JoAnn Paules MVP Microsoft [Publisher] "Katie" <Katie@discussions.microsoft.com> wrote in message news:8DB79627-DD4E-4B30-9F8A-BB9CEEE9C6D2@microsoft.com... > can I format a publisher document so people can alter the text, but leave > the > formatting and layout alone? You could put the la...

Text formatted for Days and Dates
I am preparing an electronic diary. For this I require two pieces of texts (for all the days in 2010) in the following format. 01-01-2010 (Friday) 01-01-2010 (Fri) I did the same for 2009...but for I forgot the steps and I do not have the spread sheet with me now. For this I have entered 01-01-10 in B1after formatting it as dd-mm-yy In B2 I have enetered B1+1 and copied upto B365 Cells B2to B365 were formatted as dd-mm-YY. Then in cell A1 I entered =B1 and formatted as DDDD. I got all the days in the format "Friday" Then I typed =A1+1, in A2 and copied upto A365. I g...

How do I change column labels from numbers to letters in Excel?
In Excel, my column headers somehow changed from letters to numbers. How do I get the letter headings back? For example, I can no longer reference cell C3 because the C is now a number. Hi Allison, Try: Tools | Options | General | Check R1C1 Reference Style --- Regards, Norman "AllisonCincy" <AllisonCincy@discussions.microsoft.com> wrote in message news:12E43CB2-78D6-49D7-9584-4AD3DC34DDFB@microsoft.com... > In Excel, my column headers somehow changed from letters to numbers. How > do > I get the letter headings back? > > For example, I can no lon...

reduce decimal places of number used in formula
I use Excel 2000. I pulled a number with 5 decimal places into a contract, reducing it to 3 decimal places. I then use that number in a formula to figure a cost to be billed. I only want to use the 3 decimal number in the formula. Is there a way for the formula to use the 3 decimals only without having to actually re-type the number. I use this sheet monthly and would like it to do it automatically. Catz, If your number is in cell A1, when you reference it, use ROUND(A1,3) So, instead of =A1*100 use =ROUND(A1,3)*100 HTH, Bernie MS Excel MVP "CatzJ" <CatzJ@di...

Maximum number of rows in Excel XP (2002)
Can someone tell me the MAXIMUM number of rows in Excel XP or how high have you been? We are getting read to deploy Office XP and this is something we are taking into concersation. Please Advise Thanks Kevin Payton kpayton@amig.com Hi Kevin 65536 rows per worksheet, absolute limit. Wether Excel is "filled" before that depends on "rows with what". Pure text and numbers require no muscle. Formulas are more demanding, how much is depending on their complexity. Formatting like fonts and borders bloat the files and eats graphical memory, so does controls and graphics. I&...

Update Values from a Userform
Dear all, I'm trying to update some information in ms access from a useform in ms excel. My problem is that I don't known how to do for the vba code understand the values in my form... This is the code: Sub update_tax() Dim wrkSpace As DAO.Workspace Dim db As DAO.Database Dim qryDef As DAO.QueryDef Dim qryNome As String Dim strSQL As String Dim strDB As String On Error Resume Next strDB =3D ThisWorkbook.Path & "\bd.mdb" Set wrkSpace =3D Workspaces(0) Set db =3D wrkSpace.OpenDatabase(strDB) qryNome =3D "qryUpdate_Tax" db.QueryDefs.Delete qryNome strSQL =3...

numbering rows
i need to number my rows in a seperate column to count my inventory, but when i filter my coulmns and do a custom filter my number column filters along with the others even if the number column is not filtered??????????????? If I understand your question you want to see the visible rows numbered in sequence? If so assume your data is in column A with titles on row 1, in the column you want the row numbers to appear (say column B for this example), enter the following formula in cell B2: =SUBTOTAL(3,A$2:A2) Copy this formula down. -- Cheers, Shane Devenshire "olga" wrote...

Adding ship-to phone number to SOP documents
How can I add the phone number from the ship-to address ID to SOP documents in Report Writer? Thanks. -- Jim@TurboChef Nevermind - found it in the Sales Transaction Work table. -- Jim@TurboChef "Jim@TurboChef" wrote: > How can I add the phone number from the ship-to address ID to SOP documents > in Report Writer? Thanks. > -- > Jim@TurboChef ...

How to Customize Formatting Palette
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Is there any patch to go back to the 2004 layout, or to customize the formatting palette, without going back to Word 2004? <br><br>I just updated to Office 2008 (on Mac 10.6), from Office 2004. (I may go back.) Immediately I saw that Word 2008's approach to toolbars and the formatting palette violated two rules of usability: <br> First: 2008's toolbars use up more screen space for the same tasks. <br> Second: 2008 requires more keystrokes to use the same commands. <br><...

Auto Numbering 09-24-04
I'm planning to implement MS CRM, and for all entities I want to keep the prefix's as-is fot the auto numbering, but I would like to have the numbering start with YYYY-001 each year so this year 2004-001, next year 2005-001 and so on. Can this be possible from the client or is it possible to change this feature in the database manually each year? Hans Inge Letnes ErgoGroup Norway The next sequence number is stored in the DB so you could definately "reset" it each year after changing your prefix. Look at the organizationBase table for more information. Matt Parks MVP ...

File Formats
Will my *.mny file from Money 2001 work with Money 2004? Provided 2001 and 2004 are from the same region. i.e. both US or both UK. -- Regards Bob Peel, Microsoft MVP - Money Hints/Tips http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny UK Wishes/Suggestions mnyukwsh@microsoft.com "tcolby" <tcolbymn@yahoo.com> wrote in message news:3f9101c3764f$fb2adc90$a301280a@phx.gbl... > Will my *.mny file from Money 2001 work with Money 2004? To be precise, Money 2004 will upgrade your Money 2001-compatible file to one that is Money 2004-compatible (assumin...

Some Conditional Formats Not Available
I am using Excel 2000 on a network. Conditional Formatting for font typeface and size are not available under any circumstances. Has anyone else had this problem and/or identified the cause and/or remedy? Also the border options are severely limited (no bold or double lines). Is this normal, or is there something wrong with our Excel installation here? Hi this is normal! If you need these kind of formats you have to use VBA -- Regards Frank Kabel Frankfurt, Germany "Tom Nichol" <Tom.Nichol@jus.gov.on.ca> schrieb im Newsbeitrag news:776377E5-6A73-442D-82D3-0A433714D046@m...

Conditional Formatting (on OpenForm?
Hi, I have a form with datasheetview. I want to add conditional formatting to some textboxes. I have to do this via code, because it can be variable. (The expression compares the vendor-price with the client-price.) I add the conditional formatting on OnOpen-event. The problem is that the fields have a NULL-value at that time, I guess, because it crashes on the expression. What am I doing wrong? Via the dialogboxes this works, but via code it crashes. (Type mismatch error) ---- Code: ----- Me.TCP_VENDOR.FormatConditions.Delete Set objFrc = Me.TCP_VENDOR.FormatConditions.A...

format cells option not working
when i highlight some cells and try to format them nothing happends, workbook and sheets are not protected, cells in question dot not have any data in them at all, totaly blank! if they are locked how can i findout? and how to unlock them? Thanks, Steve Maybe this? OFF: Changes to Fill Color and Fill Pattern Are Not Displayed http://support.microsoft.com/default.aspx?scid=kb;en-us;320531 -- Regards Ron de Bruin http://www.rondebruin.nl "Steven" <me@where.why> wrote in message news:K3Yfc.2505$UG1.744@newsfe5-gui.server.ntli.net... > when i highlight some cells and...

Anyway to show last 4 of cc number?
Is there a way to display the last 4 digits of a card on the account name without manually adding it? I'm using 2003 No. I just make it part of the account name, as you describe. How many can there be? "Rob" <Rob@nospam.com> wrote in message news:O3vp7qVTHHA.4764@TK2MSFTNGP05.phx.gbl... > Is there a way to display the last 4 digits of a card on the account name > without manually adding it? I'm using 2003 > ...

Counts number of entries per day in query
using access 2007, i have a query that shows Event Type State Date/Time* DayCount ALARM ACT/UNACK 01/01/2010 00:13:38 1 ALARM ACT/UNACK 01/01/2010 00:13:49 1 ALARM ACT/UNACK 01/01/2010 00:17:21 1 ALARM ACT/UNACK 02/01/2010 00:13:38 1 ALARM ACT/UNACK 02/01/2010 00:13:28 1 ALARM ACT/UNACK 03/01/2010 00:13:38 1 my SQL is SELECT [Alarm Data Filtered by Date].[Event Type], [Alarm Data Filtered by Date].St...

Conditional Formating multible if statements
In CF condition 1 I have Formula is =IF(v11=TODAY(),X11="") format is RED. In condition 2 my formula is IF(V11=TODAY()+3,X11="") format is YELLOW. Columns V11=Date Due and X11=Date Complete This CF works until I found out in some cases I can't put a date completed because I am waiting customer authorization, so I started entering pending and when I did that the CF went to the default. What I want to know is if I enter pending in X11 can I still apply the above conditions until I enter a date in the date completed column? I am not sure why your existing equations...

Auto Update Pivot Table and format wrap text
I have this code in a module, so as to refresh automatically a pivot table in a sheet named "PrintSheet" it works fine in till I added some extra code to format the cell D:D. What happens is now it tries to format every sheet I open, I only what to format every time I click on the "PrintSheet" and not in all the other sheets, and also need it to format from range D6:D not the complete column. I found out that the pivot table does not keep its format properties, so when new data is added it need to be formatted everytime, that is why I like to do this auto refresh/format. ...

Is there a limit on number of rows?
Is there a limit on number of rows? I want a spreadsheet that has a row for every day for many years. That would be thousands of rows. Is there a limit? -- Chris 65,536 (2^16) "Chris" <nospam@[127.0.0.1]> wrote in message news:KXcPW7bbQflDFwuK@[127.0.0.1]... > Is there a limit on number of rows? > I want a spreadsheet that has a row for every day for many years. > That would be thousands of rows. > Is there a limit? > -- > Chris Thankyou. In article <#e3UMXq#FHA.1256@TK2MSFTNGP15.phx.gbl>, CarlosAntenna <nunayo@binnez.com> writes >65,53...

count number of occurences on a particular date
Hello all: I have a spreadsheet where I want to count the occurences of a value on a certain date and then use the resulting information in a chart. My spreadsheet looks someting like this: Column *A* contains the ID of the defect Column *B* contains the status Column *E* contains the open date Column *F* contains the closing date if closed. An example spreadsheet would be: 123 Closed 05/12/2006 07/24/2006 100 Open 04/30/2006 125 Fixed 05/12/2006 180 New 09/22/2006 140 Closed 07/01/2006 07/24/2006 I would like to: *a)* count the number of defects that are open on each dat...

FORMATTING - hard questions
I have a cell which has plain text i.e. "Hello World" but between Hello and World I press Alt-Enter to place the word "World" on the second line so that the column width doesn't have to be long. But when I reference this cell from another one, Excel not only shows a weird ASCII character in between the words but also does not show the two words on separate lines as in the original cell. Is thre a way around this? TRIM and CLEAN did not do anything. Also, I have a function that compares two cells =IF(A1=A2,"YES","NO") and I would like to do a cond...

Formatting unlocked cells
How to do formatting of unlocked cells? I have locked certain cells and wish the user to have freedom o formatting other (unlocked) cells. But once the sheet is protected formatting etc. are not possible even for unlocked cells. I am using Excel2000 and under protection password dialogue, the chec boxes are as 'Contents', 'Objects' & 'Scenarios'. How to solve the problem -- Message posted from http://www.ExcelForum.com Hi Bhuktar You can't, this behaviour is by design in Excel. HTH Cordially Pascal "Bhuktar S >" <<Bhuktar.S.18lx28@excelfo...

How to convert date field to number value
Hi, I need to convert an Excel date field such as "9/26/1964" to the value of "19640926". Is this possible? Thanks -- landj68 ------------------------------------------------------------------------ landj68's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28004 View this thread: http://www.excelforum.com/showthread.php?threadid=475075 Using a custom format for the cell you can rearrange the order. B going into the Format menu then Cell menu. In the Number tab scroll t custom and input "yyymmdd" without the quotes and the c...

how do i enter numbers starting with zero in excel
i am trying to enter account numbers into my worksheet but when i hit return it removes the leading zeroes, how do i keep them. FORMAT / CELLS / NUMBER / TEXT ok HTH, -- Gary Brown gary.DeleteThis2SendMeAnEmail.Brown@kinneson.com "achitsyerself" wrote: > i am trying to enter account numbers into my worksheet but when i hit return > it removes the leading zeroes, how do i keep them. Type a leading apostrophe - makes it text, which is fine for numbers you're not going to use in arithmetic calcs. Bob Umlas Excel MVP "achitsyerself" <achitsyerself@discussi...