+ Reply to Thread
Results 1 to 10 of 10

Userform code and add and remove entries on sheet

  1. #1
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Userform code and add and remove entries on sheet

    Im using a 'Users' userform which loads when the workbook opens, for users to login with a username and password. Im having problems with the code to create a new user (entering the username and password data into the sheet), and deleting users (finding the username in the range, and deleting the row). I feel both of these codes used to work fine, but I have been working tweaking it, and working on other code in the form and now I can't get them to work.

    This is the Command Button code for creating a new user. It doesn't produce any errors, but nothing is getting added to the sheet:
    Please Login or Register  to view this content.
    This is the Command Button code for deleting a user. It produces Run-time error '13', Type Missmatch:
    Please Login or Register  to view this content.
    I have also attached my workbook. I have disabled the form from loading on startup. It can be opened by clicking on the Users button on the main 'Return Data' page.
    Thanks,
    James
    Attached Files Attached Files

  2. #2
    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 code and add and remove entries on sheet

    Hi Nitefox

    Your Workbook Open Event is looking for a Sheet named "Search" but does not find it
    Please Login or Register  to view this content.
    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.

  3. #3
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Userform code and add and remove entries on sheet

    Sorry, I removed the page to get the file size down, just ignore that.

  4. #4
    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 code and add and remove entries on sheet

    Hi Nitefox

    Zip your file if you must...let us see the original file...

  5. #5
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Userform code and add and remove entries on sheet

    I removed the code looking for the 'Search' sheet on workbook open (see new workbook attached).
    Dont worry, the search sheet has nothing to do with the 'User' userform.
    Attached Files Attached Files

  6. #6
    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 code and add and remove entries on sheet

    Hi Nitefox

    In the Add Button Code you need to add the dots (.) such as this
    Please Login or Register  to view this content.
    In the Delete Button Code try this
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Userform code and add and remove entries on sheet

    Thanks Jaslake.
    The Delete button code works great, but the Add user button still doesn't work. It seems to add a blank entry to the list. Whats strange is no data gets added to the sheet, but the Dynamic range keeps expending as if there is, just creating blank entries in the User Combo box drop down list.
    See attached.
    Attached Files Attached Files

  8. #8
    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 code and add and remove entries on sheet

    Hi Nitefox

    You missed two Dots(.)

    This
    Please Login or Register  to view this content.
    Should be
    Please Login or Register  to view this content.
    In addition, as a result ** the missing Dots(.), you have data in about Row 1622 ** Users. Delete everything below your actual Last Row...the Code will work.

  9. #9
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Userform code and add and remove entries on sheet

    Thanks, that did it.

  10. #10
    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 code and add and remove entries on sheet

    Hi Nitefox

    You're welcome...glad I could help. Thanks for the Rep.

+ 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] Sheet Code Not Updating with userform?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2012, 07:53 PM
  2. [SOLVED] Populating UserForm ComboBoxes with sheet entries
    By GalmOne in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-14-2012, 08:26 AM
  3. Need VBA code to remove entries if there are duplicates (remove them totally)
    By BrandonFromSingapore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2012, 12:50 AM
  4. Move userform TextBox entries to cells on a sheet
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-09-2011, 10:33 AM
  5. Running Sheet Code From Within A Userform Sub
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-22-2010, 01:52 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