+ Reply to Thread
Results 1 to 11 of 11

Values from Userform to Worksheet

  1. #1
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Values from Userform to Worksheet

    Greetings,
    I am using an Userform to enter values, that will need to be placed on a Worksheet. The Userform contains 2 textboxes (Rest # and AUV amount). The AUV amount needs to be placed on the Worksheet when the Rest # matches a Rest # on the worksheet. I have the following code, but it is not working.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Values from Userform to Worksheet

    I'd recommend uploading desensitized sample workbook.

    Since Textbox returns all value as string data type, if the workbook range contains numeric value, it will not match.

    If Rest# is unique, I'd avoid using Loop to speed up the process (ex: Use Application.Match() to return row# where match is found etc).
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Values from Userform to Worksheet

    CK76,
    Thank you for your advice.
    Unfortunately, I cannot upload a desensitized sample workbook due to restrictions.
    I confirmed the workbook cell range is set as "General".
    Regarding avoid using Loop, I will research this method.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Values from Userform to Worksheet

    Cell range being set to General has little relevance here Numbers stored as General will be treated as numeric type.

    What you need to ensure is that Textbox value is converted to appropriate data type if data stored in cell isn't a text string.

    Using conversion functions CDbl(), CLng() etc.

  5. #5
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Values from Userform to Worksheet

    I modified the Textbox value as follows, but still nothing is working.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Values from Userform to Worksheet

    What I mean is when you are comparing cell value against Textbox value, data type must match.

    Ex:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Values from Userform to Worksheet

    CK76,
    Let me look into this.
    Again, thank you much!

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Values from Userform to Worksheet

    You are welcome

  9. #9
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Values from Userform to Worksheet

    CK76,
    I tried running your code (in a separate macro located within the User form) and nothing hardened. Is your code needing to be within/embedded inside my code below?
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Values from Userform to Worksheet

    CK76,
    I found a work around until I rally understand your suggestion - again thanks!

  11. #11
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Values from Userform to Worksheet

    Was out for the night. But yes, you'd use CDbl in your code like....
    Please Login or Register  to view this content.

+ 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] Userform values based on values from Worksheet
    By rakotonirinas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2019, 05:52 PM
  2. values from worksheet into userform
    By mubashar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2014, 01:13 AM
  3. Paste Values from Userform into Worksheet
    By mrmoc85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2013, 02:47 AM
  4. How to add values from userform to a table in excel worksheet
    By hawaii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2012, 04:53 AM
  5. Saving values from a Userform to a variable to use in a worksheet
    By scott0102 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-28-2011, 02:10 AM
  6. Need help searching worksheet for userform textbox values
    By bsweet0us in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-16-2011, 10:57 AM
  7. printing values from worksheet to userform
    By excelkeechak in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2009, 10:31 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