Results 1 to 4 of 4

Generate combobox from list but not show the active list sheet

Threaded View

  1. #1
    Registered User
    Join Date
    07-02-2018
    Location
    australia
    MS-Off Ver
    2016
    Posts
    60

    Generate combobox from list but not show the active list sheet

    Good afternoon all
    I have a workbook with several tabs "FRONT, DATASHEET, NAMES, JOBS, PROCESSES"
    everyone works from the "FRONT" tab
    I have a button that brings up a user form with a combobox that gets its data from a list on tab "NAMES"
    When i press the button the user form appears with the data but it also shows the "NAMES" sheet
    i would like it to remain on the "FRONT" sheet whilst i use the userform
    I know it has something to do with the Sheets("NAMES"). Activate command but i don't know how to fix it
    i have fond this code online
    any help would be grateful
    Private Sub UserForm_Initialize()
    Dim i As Long, lr As Long ' define the variables
            Sheets("NAMES").Activate ' activate the sheet where you have the list to populate the combobox
            lr = Sheets("NAMES").Range("C" & Rows.Count).End(xlUp).Row ' find last row based on the last cell with values form column A. you can use any other column
            ComboBox1.Value = "" ' set values of combobox to nothing. this step will help avoiding double values
        For i = 2 To lr 'loop from row 2 to last row find. you can replace last row with a fixed row. for example in this case 7.
            With ComboBox1
                .AddItem (Cells(i, 3).Value) ' populate the combobox with the values from cell i,3
            End With
        Next
    End Sub
    Last edited by danny25; 12-30-2021 at 03:25 AM. Reason: solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] [Google sheet] Check if values in list exists in another list and show them in range
    By jaryszek in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 09-21-2021, 04:50 AM
  2. Replies: 5
    Last Post: 04-09-2016, 12:33 PM
  3. Replies: 1
    Last Post: 02-16-2016, 07:51 PM
  4. [SOLVED] show a list of names on from sheet 1 in sheet 2 when marked active in sheet 1...???
    By stolen_83 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-11-2013, 04:57 PM
  5. [SOLVED] Userform ComboBox.List Location and Active Sheet Issues
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2013, 09:55 PM
  6. Replies: 2
    Last Post: 12-23-2012, 09:26 AM
  7. Replies: 7
    Last Post: 11-11-2010, 09:51 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