+ Reply to Thread
Results 1 to 5 of 5

Dynamically Switch Worksheets Based On Selection Made From A Combobox

  1. #1
    Registered User
    Join Date
    09-23-2019
    Location
    Ghana
    MS-Off Ver
    2016 32 bit and 64 bit
    Posts
    92

    Dynamically Switch Worksheets Based On Selection Made From A Combobox

    Hello,
    I want to avoid writing more lines. That is, I want to avoid the multiple case statements.

    And I am looking for a way to dynamically determine the two sheets to send data to, based on the selection from the combobox1, without using the case statement.

    I have codes that I will run under the case statement – longer codes- and writing it three times will make my scripts too long. That is why I am looking for a way to get it written only once.

    So when I make a selection from the combobox1, I want the code to point to the two right sheets.
    For example, if the selected sheet is “Data 1” from the combobox1, then the two sheets to send data to are “Data 2” and “Data 3”.

    I wish someone could help me out with the script to get the job done. Thanks in advance.

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

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Dynamically Switch Worksheets Based On Selection Made From A Combobox

    One way.
    Load the relevant info to Combobox.
    Please Login or Register  to view this content.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Dynamically Switch Worksheets Based On Selection Made From A Combobox

    changed to code and eliminated command button

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

  4. #4
    Registered User
    Join Date
    09-23-2019
    Location
    Ghana
    MS-Off Ver
    2016 32 bit and 64 bit
    Posts
    92

    Re: Dynamically Switch Worksheets Based On Selection Made From A Combobox

    That's amazing. It worked like a charm!

    Now that I know it's possible, what I was thinking, let's see if this is possible too:

    A want to place a textbox on the userform and this time around, I am not sending any data to the sheets. But I am clearing contents from the sheets.

    So when I click the command button, I want to find or locate the id from the textbox in the range A4:A24.

    And when I find it, I want to clear the contents from the row on which the id is found.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Dynamically Switch Worksheets Based On Selection Made From A Combobox

    I think you are asking completely different question now.

    Mark the thread as "Solved" and open a new thread.

+ 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] How to "reset" a VBA code each time a combobox selection is made on a userform
    By Sybille in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2019, 04:07 PM
  2. countif across multiple worksheets based on combobox selection
    By bqheng in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2018, 10:18 PM
  3. [SOLVED] fill combobox selection based on a selection from the first combobox
    By Monza in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-14-2013, 07:34 PM
  4. Switch Column/Row based on combobox selection
    By ALBF in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-11-2013, 09:52 PM
  5. VBA Code to copy and paste a row depending on selection made in a combobox
    By ssu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-20-2013, 05:37 AM
  6. Replies: 0
    Last Post: 01-25-2013, 07:13 PM
  7. Macro switch sheet based off selection
    By ballin220 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-10-2008, 05:47 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