LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Formatting UserForm Text Field as Numeric

Thank you all for your fast responses.

Since the text fields in the UserForm must reflect the information for
whatever record I'm on at the time I do UserForm1.Show, I cannot use
something like "TextBox1.Value = Range("A1").Value" since that would
always point to cell A1. Instead, here is the section of my code that
accomplishes this for me. It's in View Code when I right-click on the
UserForm in the VBE.

(Again, this is just the section that applies to what I'm talking
about.)

============================
Option Explicit

Public CurrentRow 'current row
Public NumCols 'number of columns
Public LastRow 'last row of data
Public StartRow ' First row with data
Public StartCol ' First column with data
Public RecordCount 'No. of records
Public UndoRow 'row that was inserted or deleted
Public APPNAME As String
Public Initializing As Boolean


range(Cells(CurrentRow, StartCol), Cells(CurrentRow, StartCol +
NumCols - 1)).Select


Price.ControlSource = Cells(CurrentRow, StartCol + 8).Address
============================


One way I have found to get around this problem is to add a helper
column within the database itself giving it the name TextPrice. I
then enter the formula
=TEXT(G2,"#,##0.00"), which I then copy down the appropriate number of
rows. I then altered my code so that the Price text field in the
UserForm now refers to that helper text column rather than the numeric
Price column. I would have preferred resolving the problem within the
UserForm rather than the database in the worksheet, but it does solve
the problem. However, if any of you can come up with something I can
institute within the UserForm so as to eliminate the need for the
helper column, I'd appreciate it.

To Sam: I tried your suggestion but couldn't find "Format" in
properties.

Thanks again to all of you.


 
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
Conditionally formatting numeric data and text differently Albannach Excel Worksheet Functions 1 January 20th 10 02:18 AM
Keep text out of numeric field Diane Setting up and Configuration of Excel 1 September 29th 09 05:50 AM
Numeric date to text..formatting question JHB Excel Discussion (Misc queries) 2 October 4th 08 07:46 PM
Numeric data only in text box on userform Carlee Excel Programming 2 July 8th 07 11:54 PM
how do i step thru a text field looking for 6 numeric characters Snookman150 Excel Worksheet Functions 0 June 30th 05 01:31 PM


All times are GMT +1. The time now is 10:47 AM.

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"