+ Reply to Thread
Results 1 to 9 of 9

Userform not inputting data to the correct cells

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Mount Olympus
    MS-Off Ver
    Excel 2003
    Posts
    27

    Userform not inputting data to the correct cells

    This is a continuation from a previous thread.

    I now have a working userform (in sheet1) with an add and search function but it can only add and find data when the sheet layout is in a certain format. In the sample I attached, the original code works fine but the code does not work properly in Sheet2. I'm not very sure as to what I should be changing in the codes to get it to input the data to the correct cells.

    One more minor annoyance...

    Let's say I type in the Part Number and then the date (for eg "3-Jun-10") in the corresponding textboxes, it will put in the value "3-Jun-10" into the correct cell but when I find that part number, the date returned will be in MM/DD/YY format. How do I change it to return the exact value "3-Jun-10" ?

    Thanks for the help.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: Userform not inputting data to the correct cells

    brah,

    I don't know if this will help or not but on each of your user forms where the date is required, right-click each field, select view code, and add this between the sub and end sub lines...
    Please Login or Register  to view this content.
    It might also help if you make sure that the worksheet that has the stored data has the same format?

    I'm new to vBa but have given been many handy tips here so I'm hoping I can now return the favour as I'm learning.

    Cheers,

    AJ
    Always grateful for the help here - thanks.

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    Mount Olympus
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Userform not inputting data to the correct cells

    Quote Originally Posted by ScotyB View Post
    brah,

    I don't know if this will help or not but on each of your user forms where the date is required, right-click each field, select view code, and add this between the sub and end sub lines...
    Please Login or Register  to view this content.
    It might also help if you make sure that the worksheet that has the stored data has the same format?

    I'm new to vBa but have given been many handy tips here so I'm hoping I can now return the favour as I'm learning.

    Cheers,

    AJ
    Hi AJ,

    Tried out your code but the date seems to enter itself automatically into the textboxes. I downloaded the workbook I attached above just to make sure it was the same as the one I have on my desktop here but the code didn't work either. Funny thing happened though, I played with some values and I cannot replicate the problem I had earlier. But the dates are fine now, so I can't really complain Appreciate the help though man.

    I still need help with the coding in Sheet 2...

  4. #4
    Registered User
    Join Date
    04-05-2012
    Location
    Mount Olympus
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Userform not inputting data to the correct cells

    bump

    10 character limit

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Userform not inputting data to the correct cells

    Your code can't work. You are looping through 15 to 50,
    1.There aren't that many textboxes
    2.The textboxes need to be numbered consecutively

    Either rename the textboxes or don't try to loop to add the values

    I've changed the first 5 textboxes
    Attached Files Attached Files
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    04-05-2012
    Location
    Mount Olympus
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Userform not inputting data to the correct cells

    Hi Roy,

    The code in userform 2 worked for me. I key in the info in textboxes 15 to 50 and they populate the correct columns (P to AY). I can't get the code to work in Sheet2 because the layout of the sheet is different. This bit of code
    Please Login or Register  to view this content.
    in the form tells the userform to input the data into the next empty cell in Row A but it just doesn't happen in Userform3.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Userform not inputting data to the correct cells

    Hi brah

    In UserForm3 you have this code
    Please Login or Register  to view this content.
    Sheet2 is the Instructions worksheet. Look at this

    Sheet Name.jpg

    then think about it.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  8. #8
    Registered User
    Join Date
    04-05-2012
    Location
    Mount Olympus
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Userform not inputting data to the correct cells

    Lol! Changed the Sheet2s to Sheet3s and left the "Sheet2"s as they were and it's working fine now. I don't know how I missed that. Thanks Jaslake.

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Userform not inputting data to the correct cells

    Hi brah
    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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