+ Reply to Thread
Results 1 to 5 of 5

TextBox Output Format not Same as my Table

  1. #1
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    TextBox Output Format not Same as my Table

    The code below works nicely when I want to add items to my table but does not maintain the format to mach all items in the table. All table items are formatted with a Cyan backcolor, Arial Bold size 10 font, and the date is formatted as number (mmm-dd-yy). The output of the text boxes now is White backcolor, Arial regular size 14 and the date is formatted as text (mmm-dd-yy)

    The 4 text boxes in my userform are formatted as per above except for the date which I have no way to format as number. Another Forum member has provided the code for the “txtDate.Value” shown in the code but this outputs the date as text and not as number. The txtDate must be formatted as number otherwise sorting the Date column by Date does produce the required results

    Is there any way to have these text boxes formatted to mach my table format?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: TextBox Output Format not Same as my Table

    Try this...
    .Offset(1, 0).Value = CDate(Me.txtDate.Value)

    Or this...
    .Offset(1, 0).Value = DateValue(Me.txtDate.Value)
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: TextBox Output Format not Same as my Table

    They both work, thanks but they only format the day as number which is part of what I want and the font size / type / backcolor remains unchanged. Any idea how I can maintain the format to match the formats in my table?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: TextBox Output Format not Same as my Table

    You could just format the entire column B. Any new dates added to the column will then use that formatting.

  5. #5
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: TextBox Output Format not Same as my Table

    Formating the column does not help in my case (output of all text boxes is always with white background and different font) but reading on the web I found a page in a Microsoft forum which says:

    "The textbox does not have a built-in property that stores the 'underlying value'. You will need to store that value in a separate variable or you could make use of the .Tag property. Either way you will need to maintain the relationship between value and display of value.
    txtPercent.Tag = 0.992
    txtPercent.Text = Format(txtPercent.Tag,"0.0%")"

    So in my case can someone tell me how to use this Tag property?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Display the Output in Textbox
    By Biplab1985 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 09-03-2015, 12:31 PM
  2. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  3. [SOLVED] Correct date format from textbox in form to table
    By eddijensen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2014, 05:28 PM
  4. Activex Textbox input output value as numeric
    By mani_bbc05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2013, 03:44 AM
  5. how to force HLOOKUP to give output in the same format as the source table?
    By yessuz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-25-2013, 10:23 AM
  6. How to format TextBox output as numerical
    By knarf in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-15-2009, 02:52 PM
  7. TextBox format, input is currency, can't output onto other sheet
    By baxtercavendish in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-08-2009, 03:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1