+ Reply to Thread
Results 1 to 3 of 3

How to Select Worksheet and Cell/range based on ComboBox Values

  1. #1
    Registered User
    Join Date
    09-26-2014
    Location
    Colombia
    MS-Off Ver
    2010
    Posts
    3

    How to Select Worksheet and Cell/range based on ComboBox Values

    Dear Fellows

    I'm a beginner in VBA Excel and I am required to do something a bit advance for me. I need to select a worksheet and a cell based on the values of two comboboxes included in a userform. The idea is to create a empty table from the userform and what I believe the code structure should be is the following:

    Lets say ComboBox1.List = Array("A","B") and ComboBox2.List = Array ("C", "D")

    If ComboBox1.Value = "A" Then
    ActiveWorkbook.Sheets("Sheet1").Activate ' Select worksheet 1
    If ComboBox2.Value = "C" Then
    ActiveSheet.Range("INCTITLES").Select ' Choose a cell in a specific range (e.g., Names of Variables) that has the value of ComboBox2
    ... ' Other orders (e.g., add column to the right)
    Else..
    End If
    Else...
    ActiveWorkbook.Sheets("Sheet2").Activate ' Select worksheet 2
    End If

    If you could give some hints on how to do this, or any help, it is very, very much apreciate it. Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: How to Select Worksheet and Cell/range based on ComboBox Values

    Welcome to the world of VBA. To start, you don't usually need to activate or select a sheet or range. You can generally apply the code directly, which is faster. It is not 100% clear to me what your question is so I will give you some code that will hopefully push you in the right direction:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-26-2014
    Location
    Colombia
    MS-Off Ver
    2010
    Posts
    3

    Re: How to Select Worksheet and Cell/range based on ComboBox Values

    Thanks for your help. The goal is, through a userform, the user been able to create an empty table (with just the column titles) composed by given categories, given subcategories and items/subsubcategories to be defined, all of them linked together (sort of questionnaire). Then the table is going to be filled with specific time-dependent information of the user. The idea was too general (too much flexibility) so to be implemented. I will rethink the way of doing it. Once again thanks. Best regards.

+ 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] Select Range based on COmboBox selections
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2013, 11:24 PM
  2. Lookup combobox in range and select adjacent cell
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2013, 04:21 PM
  3. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  4. [SOLVED] Select a range of rows based on start row and end row being values in two worksheet cells
    By xlnube in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2012, 08:41 PM
  5. [SOLVED] How to select a range based on values in 1 column
    By ForestRamsey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2005, 12:05 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