+ Reply to Thread
Results 1 to 11 of 11

Using one listbox to edit data from multiple worksheets

  1. #1
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Using one listbox to edit data from multiple worksheets

    Hello All,

    Reaching out for some help once again. I have a listbox that is populated from a combobox when a worksheet is selected. When I click on a selection in the listbox it populates the corresponding textboxes below. I have the below code that’s supposed to edit whatever selection I make, but instead it edits the entire table. My second problem is that it only works (if you can call it that) on one worksheet (Re-Enlistments). I want to be able to edit all the worksheets in the combobox. Code is below and file is attached. As always, I’m grateful for any assistance.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Using one listbox to edit data from multiple worksheets

    but instead it edits the entire table.
    That is because you are looping the entire tables rows
    Please Login or Register  to view this content.
    My second problem is that it only works (if you can call it that) on one worksheet
    As you are not referencing a sheet, this code below works on active sheet only...
    Please Login or Register  to view this content.

    Try this to see what I mean...
    Please Login or Register  to view this content.

    I want to be able to edit all the worksheets in the combobox
    Not all worksheets have the same info as your listbox selections though?
    Are you wanting to search for criteria and update accordingly...
    Last edited by Sintek; 07-15-2020 at 05:17 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Using one listbox to edit data from multiple worksheets

    Not so sure if I get what you want exactly,
    anyway the code below is "cheating" by insert a number (for row number) to the corresponding sheet :


    Please Login or Register  to view this content.
    I want to be able to edit all the worksheets in the combobox
    It will edit the corresponding sheet (which is selected via the combobox).
    But if you mean :
    the user select Re-Enlistments sheet in the combobox,
    select one item in the ListBox1,
    edit a value in the text-box
    click the CommandButton1
    then the user expecting that the edited value in the text-box is updated in Re-Enlistments sheet AND ALSO to Retirements and C-Ways sheet.....

    The code don't do that, as it only updated the selected sheet via the combobox.
    If the user select Re-Enlistments in the combo-box, then the updated cell (according to what's in the text box) will be just only to Re-Enlistments sheet.
    If the user select Retirements in the combo-box, then the updated cell (according to what's in the text box) will be just only to Retirements sheet.
    If the user select C-Ways in the combo-box, then the updated cell (according to what's in the text box) will be just only to C-Ways sheet.
    Last edited by karmapala; 07-15-2020 at 06:21 AM.

  4. #4
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Using one listbox to edit data from multiple worksheets

    first of all,

    thank you for the overwhelming replies. i love this forum!!!. both suggestions work beautifully, and this may have to be a different post, but since i have everyone's attention... how to do i go the sheet or active the sheet i'm editing and show the edit in the listbox as well?

    roro

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Using one listbox to edit data from multiple worksheets

    Just add this snippet
    Please Login or Register  to view this content.
    after you've updated...

  6. #6
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Using one listbox to edit data from multiple worksheets

    brilliant!!! thank you kindly!!!

  7. #7
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Using one listbox to edit data from multiple worksheets

    I hope i'm not wearing out my welcome, but is there a way to activate the selected sheet?

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Using one listbox to edit data from multiple worksheets

    Not sure where you want the snippet of code...or why you want to activate it....
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Using one listbox to edit data from multiple worksheets

    Quote Originally Posted by RoroBear View Post
    I hope i'm not wearing out my welcome, but is there a way to activate the selected sheet?
    I don't exactly understand what you mean, but I guess that you want the sheet is activated once the user select the item (the name of the sheet) in the ComboBox1.

    change this :
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.


    in combobox1_change() sub, add this line :
    Please Login or Register  to view this content.
    This line will activate the sheet once the item (sheet name) in the ComboBox1 is selected.

    then finally in CommandButton1_Click sub :
    Please Login or Register  to view this content.
    This will unload the userform first, so you can see the updated text in the cell of the sheet,
    then after the msgbox OK button is clicked, it will activate the "To Do List" sheet.

  10. #10
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Using one listbox to edit data from multiple worksheets

    i wanted the worksheet to active once it's selected from the dropdown, and the codes provided did just that. thank you everyone!!! as always, really appreciate the positive feedback.

  11. #11
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Using one listbox to edit data from multiple worksheets

    Glad we could assist...Tx for 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. Search and edit the data from multiple worksheets from userform
    By bujaber10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2019, 10:01 AM
  2. [SOLVED] Edit select data on Listbox
    By kirana2014 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-29-2017, 01:15 AM
  3. Replies: 0
    Last Post: 08-27-2015, 09:44 PM
  4. select multiple column listbox to edit userform
    By tbar05 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2012, 12:13 AM
  5. edit multiple data on multiple worksheets all at once
    By semidevil in forum Excel General
    Replies: 1
    Last Post: 10-17-2010, 06:03 PM
  6. UserForm selected data; to edit multiple worksheets(& specific rows)
    By anonfish in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2010, 11: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