+ Reply to Thread
Results 1 to 5 of 5

Userform textbox doesnt format

Hybrid View

  1. #1
    Registered User
    Join Date
    02-09-2015
    Location
    Mazeikiai, Lithuania
    MS-Off Ver
    2007
    Posts
    18

    Userform textbox doesnt format

    Hi

    Please help me

    I have userfom with textboxes and calculation between them.
    After that I formated textbox value without demicals (textbox1=format(textbox1.value,"#") and I got value as ex. 1445 (real 1445,234)
    Everything works perfect until I use userform from another computer. Calculation is perfect but format doesnt work,
    value of textbox1 become 1445234 without comma. Why this happen?

    Thank You

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Userform textbox doesnt format

    Your code is formatting whatever is already in textbox1 instead of formatting the source data. How does this data get into textbox1 to start with?

    Also, the other computer may be using U.S. default formatting, which will ignore the comma when it reformats it to "#".

    I suggest you attach your file and explain how to reproduce the situation you described.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-09-2015
    Location
    Mazeikiai, Lithuania
    MS-Off Ver
    2007
    Posts
    18

    Re: Userform textbox doesnt format

    Hi 6StringJazzer, thanks for Yours reply

    Data in textbox1 goes from calculation and after that I am tryng to formart this textbox. I tried "#", "0" both same result.

    My file exceed limit of size, here is code how I am doing this:
    Private Sub CommandButton1_Click()
    On Error GoTo klaida
    '1v 2v 3v
    Dim num(1 To 110) As Integer
    
    num(100) = TextBox84.Value
    num(101) = TextBox85.Value
    num(102) = TextBox86.Value
    num(103) = TextBox87.Value
    num(104) = TextBox88.Value
    num(105) = TextBox89.Value
    num(106) = TextBox90.Value
    num(107) = TextBox91.Value
    num(108) = TextBox92.Value
    num(109) = TextBox93.Value
    
    num(1) = TextBox1.Value
    num(2) = TextBox2.Value
    num(3) = TextBox3.Value
    num(4) = TextBox4.Value
    num(5) = TextBox5.Value
    num(6) = TextBox6.Value
    num(7) = TextBox7.Value
    num(8) = TextBox8.Value
    num(9) = TextBox9.Value
    num(10) = TextBox10.Value
    num(11) = TextBox11.Value
    num(12) = TextBox12.Value
    
    '50 sasagos
    TextBox13.Value = (num(1) + 2) * 2 * num(105) + (num(1) + 2) * 2 * num(105) * num(100) / 100
    
    '38 sasagos
    TextBox14.Value = (num(2) * 2 + (2 + num(1)) * (num(3) + 4)) * num(106) + ((num(2) * 2 + (2 + num(1)) * (num(3) + 4))) * num(106) * num(100) / 100
    
    '25 sasagos
    TextBox15.Value = num(4) * num(107) + num(5) * num(108) + (num(4) * num(107) + num(5) * num(108)) * num(100) / 100
    
    '25 spreiz sasagos
    TextBox16.Value = num(6) * num(109)
    
    '16 sasagos
    TextBox17.Value = (((2 + num(1) + num(2)) * num(10) + 2 * num(7)) + ((2 + num(1)) * num(11) + (2 + num(3)) * num(7)) + ((2 + num(1)) * num(12) + 2 * num(7))) / num(101) + (2 * num(7) + 2 * num(9)) / num(102) + ((((2 + num(1) + num(2)) * num(10) + 2 * num(7)) + ((2 + num(1)) * num(11) + (2 + num(3)) * num(7)) + ((2 + num(1)) * num(12) + 2 * num(7))) / num(101) + (2 * num(7) + 2 * num(9)) / num(102)) * num(100) / 100
    
    '10 sasagos
    If CheckBox2.Value = True Then
    TextBox18.Value = (num(7) * 4 + num(8) * 2) / num(103) + (num(1) * 30 + 60) + num(1) * 50 + ((num(7) * 4 + num(8) * 2) / num(103) + (num(1) * 30 + 60) + num(1) * 50) * num(100) / 100
    Else
    TextBox18.Value = (num(7) * 4 + num(8) * 2) / num(103) + (num(1) * 30 + 60) + ((num(7) * 4 + num(8) * 2) / num(103) + (num(1) * 30 + 60)) * num(100) / 100
    End If
    
    TextBox13 = Format(TextBox13.Value, "#")
    TextBox14 = Format(TextBox14.Value, "#")
    TextBox15 = Format(TextBox15.Value, "#")
    TextBox16 = Format(TextBox16.Value, "#")
    TextBox17 = Format(TextBox17.Value, "#")
    TextBox18 = Format(TextBox18.Value, "#")
    
    Exit Sub
    klaida:
    MsgBox ("Uþpildyti visus langelius, jei nëra, áraðyti 0")
    End Sub
    Now I am tryng to resize my file, and I ll attach it

  4. #4
    Registered User
    Join Date
    02-09-2015
    Location
    Mazeikiai, Lithuania
    MS-Off Ver
    2007
    Posts
    18

    Re: Userform textbox doesnt format

    Here it is
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-09-2015
    Location
    Mazeikiai, Lithuania
    MS-Off Ver
    2007
    Posts
    18

    Re: Userform textbox doesnt format

    Still help needed. Can find solution why format doesnt work

+ 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. [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
  2. Get Data from UserForm (TextBox, ListBox) doesnt work
    By BorisMKD in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-15-2014, 05:07 AM
  3. [SOLVED] Excel 2007, Userform Textbox Date Format and Calendar Control Userform
    By riffology in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2014, 06:18 PM
  4. format a TextBox on a userform
    By randyvann in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-20-2008, 05:14 PM
  5. [SOLVED] Format TextBox in UserForm
    By vgarrow@carletonls.com in forum Excel General
    Replies: 2
    Last Post: 07-21-2006, 04:20 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