+ Reply to Thread
Results 1 to 4 of 4

Userform with textboxes to update table with numeric values instead then string-values.

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    Userform with textboxes to update table with numeric values instead then string-values.

    Hi!
    I have created a userform so some users can add new records into a table/database in Excel. I am using textboxes on the userform, with some validations.
    The issue for me now is that after all the textboxes has been filled with values, the values is pasted into the table, and then the next record shall be added. This works great,
    BUT the problem is that the values added into the table is added as string values, and not as "percentage-values". An example: A value in the table will be addes as "5%" (with the green triangle in the upper corner of the cell)
    instead of as aVALUE of 5%.

    Is there a way to make Excel understand that the values in the textboxes should be added into the table as values, and not as text-strings?
    Have thought about "exit events"? What I don't understand though is how to get the exit events to "kick in" when ALL the values in the textboxes are "copied" into the table? The exit events, as I understand them , are connected to each
    individual text-box, and not all of them at once....

    When I have filled in all the textboxes in the userform I have a "cmdADD"-private-sub that adds the values into the table.

    Any ideas?
    Best Regards from Sweden
    Björn

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Userform with textboxes to update table with numeric values instead then string-values

    If the user is entering 5. (with % understood) then the code that writes the 5 must do the division and write 5/100 to the cell.

    If user is writing 5%, then XL will think string. So dont allow characters. Or trim out bad chars before the write.

  3. #3
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Userform with textboxes to update table with numeric values instead then string-values

    Brilliant!
    That should do the trick....
    Thx m8!

  4. #4
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Userform with textboxes to update table with numeric values instead then string-values

    Yep, that did it! Thx a lot!

+ 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] How to i validate if all the values entered in userform textboxes are valid then execute.
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2013, 12:33 PM
  2. Why is my UserForm code adding a string of values instead of the values themselves?
    By RayJay01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2013, 10:25 AM
  3. Extracting Numeric Values from an Alpha/Numeric String
    By Delkath in forum Excel General
    Replies: 5
    Last Post: 10-27-2010, 02:36 PM
  4. Userform Textboxes showing wrong values?
    By Panic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2008, 09:43 PM
  5. Numeric values vs Char/String values
    By Mike k in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-14-2006, 12:34 AM

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