+ Reply to Thread
Results 1 to 3 of 3

VBA code to show updated data in the listbox after the data is entered and button clicked

  1. #1
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    213

    VBA code to show updated data in the listbox after the data is entered and button clicked

    When the attached workbook's userform is opened, data is entered in the textbox and is saved to Sheet2 when the save button is pressed. Is there any additional code that I can include that can do the below:

    After data is entered for any line of data, the save button is pressed and does the below:

    1. Data saved to the record in sheet2 (the form already does this)
    2. Send the entered data to the listbox so it is visible (i.e. updated) in the listbox in the relevant line

    One way to show the new data in the listbox is to use code to close the form and then reopen the form but I don't want to use this method.

    Would appreciate your input!
    Last edited by chin67326; 12-25-2015 at 04:23 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA code to show updated data in the listbox after the data is entered and button clic

    Just call the form's initialize procedure at the end of the bttnSave_Click procedure. This will repopulate the listbox.

    Call UserForm_Initialize
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    213

    Re: VBA code to show updated data in the listbox after the data is entered and button clic

    Quote Originally Posted by AlphaFrog View Post
    Just call the form's initialize procedure at the end of the bttnSave_Click procedure. This will repopulate the listbox.

    Call UserForm_Initialize
    Thanks and so simple!

+ 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] code to deselect if empty record is clicked in listbox
    By adelkam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-26-2015, 02:07 PM
  2. [SOLVED] Userform Cancel button when clicked still inputs data
    By Mr_Bill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2014, 01:04 PM
  3. Listbox Click event problem - last and not current clicked data gets filled in form
    By wonderolga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2014, 09:04 AM
  4. Replies: 0
    Last Post: 05-13-2014, 03:03 AM
  5. Textbox to show values when clicked items on listbox
    By Benjamin2008 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-11-2013, 07:02 PM
  6. [SOLVED] Scrolling listbox to show last entered item
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-11-2012, 09:33 AM
  7. Validate Data in Worksheet When Button is Clicked
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2012, 12:28 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