Results 1 to 15 of 15

Textbox decimal value to cell formula

Threaded View

  1. #1
    Registered User
    Join Date
    07-24-2011
    Location
    Brasov
    MS-Off Ver
    Excel 2010
    Posts
    18

    Textbox decimal value to cell formula

    Hi everybody!

    I have the following code:

    Private Sub Textbox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
    Me.TextBox1 = Format(Me.TextBox1, "#,##0.00")
    End Sub
    
    Private Sub CommandButton1_Click()
    Range("B4").Value = "=Round(C2*C10,2)+" & TextBox1.Value
    End Sub
    If I run this code it gives me a Runtime error '1004': Aplication-defined or object-defined error, and marks the codeline where I want to add the Textbox value to the cell formula.

    If I remove the formatting Sub, and enter an integer value, then everything works great, but when I introduce the formatting option or a decimal number the problem starts again.

    How can I solve this problem?

    Thanks in advance for your help.
    Last edited by bgabi89; 04-10-2017 at 05:14 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Textbox to accept integers or decimal numbers only
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-23-2017, 03:51 AM
  2. [SOLVED] Only allowing numbers and decimal in a textbox
    By DannyJ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2016, 03:01 AM
  3. problem with input decimal numbers into a textbox
    By Röbke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2016, 06:41 PM
  4. Userform textbox output to one decimal place
    By Tubes2015 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2015, 11:12 AM
  5. [SOLVED] Have formula results/textbox to round value at 0 decimal places
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2015, 09:58 AM
  6. Textbox decimal numbers
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2007, 01:02 PM
  7. Textbox value decimal problem
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2007, 09:30 AM

Tags for this Thread

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