+ Reply to Thread
Results 1 to 5 of 5

Updating VBA form with worksheet Data

  1. #1
    Registered User
    Join Date
    10-26-2016
    Location
    NY
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Updating VBA form with worksheet Data

    I have a Userform built and would to use it to not only add new data but also update data. Adding data is not a problem, that works. But I am having trouble loading the data from the worksheet back into the userform to update it. The form is trigger by clicking on any row in column A. So if A2 was clicked, 2 would be myRow. What am I missing to load the already populated data into the form?

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: Updating VBA form with worksheet Datata

    The code you use to update the sheet, can you place the same code you use in the initialize event to repopulate the userform controls?.

  3. #3
    Registered User
    Join Date
    10-26-2016
    Location
    NY
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Updating VBA form with worksheet Datata

    I was under the impression that

    Please Login or Register  to view this content.
    would repopulate the userform controls with the values from those cells?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner VA USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,444

    Re: Updating VBA form with worksheet Data

    First of all the name of your Sub is incorrect. It must be named

    Please Login or Register  to view this content.
    regardless of the actual name of the form. It must be located in the code module for the form.

    Also note that this is run only when the form is first loaded. If you want to change the data after it's loaded, then you need to use

    Please Login or Register  to view this content.
    which will run each time Show is called on the form after it's loaded.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    10-26-2016
    Location
    NY
    MS-Off Ver
    MS Office 2016
    Posts
    25

    Re: Updating VBA form with worksheet Data

    Oh wow how could I miss something so simple. Works like a charm now. Thank you very much!!

+ 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. VBA User Form Updating Data and dynamic date ranges
    By DaveNUFC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2016, 01:32 PM
  2. Form updating worksheet
    By ekcut in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2016, 03:25 AM
  3. Replies: 0
    Last Post: 10-08-2013, 02:58 PM
  4. Replies: 1
    Last Post: 08-28-2013, 05:04 PM
  5. [SOLVED] User Form not updating worksheet
    By denise6372 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2012, 02:47 AM
  6. Replies: 0
    Last Post: 03-03-2012, 03:29 AM
  7. Transfer User form data to a worksheet w.r.t. combobox item on the form
    By nm766 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2011, 12:43 PM

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