+ Reply to Thread
Results 1 to 12 of 12

Userform is not working properly

  1. #1
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Question Userform is not working properly

    I have created a userform but it is not working properly.

    It is very straight forward, there are 3 sheets. One is SWDashboard where there is a button to activate the form. The Second is SWDatabase where all the info of the userform will saved. And 3) the SWMaster where the userform gets all the info.

    Problems I am experiencing and I need help in is the following.

    1) When I click on the button on the SWDashboard sheet and I start playing with the buttons it is not saving in the correct sheet. For example if I select, view last row nothing appears. Or if I press submit it enters the data in the wrong worksheet.

    2) I want to do a validation where the Qty IN = as the QTY OUT + QA/Retains + All the rejects. If this statement is not true to give a message box saying "Please verify that the quantities are correct.

    3) The date is not appearing either when I open the form.

    Thanks for your help.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform is not working properly

    Whenever you have something like this, without a sheet reference, VBA will refer to cells on the active sheet.
    Please Login or Register  to view this content.
    You need to provide a sheet reference for every instance of Cells you have in the userform module, for example.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Re: Userform is not working properly

    It didn't work for some reason. It is still not working. I have added that reference in the With Sheets("SWDatabase") ... End With and it is still not working for some reason.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform is not working properly

    Did you add the . in front of Cells? That's kind of important as it 'ties' Cells back to the worksheet.

  5. #5
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Re: Userform is not working properly

    Yes i did look.1.PNG

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Userform is not working properly

    Any particular reason you go get the last used row in Col A, then add 1 and use that as the source...?

    Maybe I misunderstand, but getting the last used row does just that. Anything below it is blank as it's after the last used row.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform is not working properly

    What exactly is the code in the Initiliaze event meant to do?

    As far as I can see all it does is find the next blank row on 'SWDatabase' and then populate the userform from that row, which is blank, which is why the userform is blank.

    Which row do you want to populate the userform from when it opens?

  8. #8
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Re: Userform is not working properly

    So when the userform opens I want for the fields to be empty except for the date that I want it to be populated automatically. And then it depends what I want to do. So for example if I click on View Last Row, I want to see that last row inputted in the SWDatabase worksheet. If I put submit I want for the information to be added after the last row. If I put previous, I would like to show me first the last row, If I click previous again, then it starts going up to the previous row. If I put next then it will bring you to the next row. If it is in the last row it will tell you, that you are in the last row. I just want when the form initialize that all the buttons work and all data will be sent, saved and update the database.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform is not working properly

    If that's what you want to happen on initialisation all you should need is this.
    Please Login or Register  to view this content.
    Note this sets currentrow to the next blank row, so when you press the CmdPreviousRow button the userform will be loaded with data from the last row.

    By the way, have you changed the rest of the code so it properly references the worksheet?

    For example, this is how the CmdSubmit code should look.
    Please Login or Register  to view this content.
    If you make the suggested changes throughout the code the userform should have the functionality you describe.

  10. #10
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Re: Userform is not working properly

    Thank you now it is working. Thanks a lot

  11. #11
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Re: Userform is not working properly

    And the last question that I did on my first post is still missing, how can I do the verification calculation in the form so Qty IN has to be equal to Qty Out + QA/Retains + All the rejects?

    Capture.PNG

  12. #12
    Registered User
    Join Date
    03-22-2017
    Location
    San Francisco
    MS-Off Ver
    Windows 7 professional
    Posts
    29

    Re: Userform is not working properly

    So basically i want to make sure that the qty in is the same number as the summation of qty out + QA/retains + all the rejects like LCP Stains, LCP Flash, etc...And if this summation is not equal to Qty in then to give me a message saying to check the numbers.

+ 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. userform not working properly
    By shiva_raj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2017, 04:53 PM
  2. [SOLVED] More than and Less than not working properly
    By Alidamalang110 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-23-2015, 12:34 PM
  3. I deleted a userform and am not sure if everything else is working properly
    By trfountain22 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2015, 03:58 PM
  4. [SOLVED] IF-THEN-ELSE not working properly
    By danex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-02-2013, 11:15 AM
  5. VBA not working properly
    By stevemills04 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2013, 02:56 PM
  6. [SOLVED] Userform Find Founction not working properly
    By Jeff up North in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-12-2013, 01:38 PM
  7. UDF not working properly
    By demuro1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2008, 04:36 PM

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