+ Reply to Thread
Results 1 to 5 of 5

Create combobox if left cell has a value

  1. #1
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Create combobox if left cell has a value

    Hey guys,

    Hopefully a simple question for you all

    Check Image: o9gsiijgm55z1o53qpwb.jpg

    I have some code which populates the Primary Key column with Numbers..
    what I need to do is automatically setup a combo box right beside who's source comes from a static list on another sheet.

    Does anyone know the correct VBA code to setup a combo box on the cell as shown in the image? The combo box should only be setup if the cell beside it (i.e. column A) has a value.

    Thank you!

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Create combobox if left cell has a value

    Untested:

    Please Login or Register  to view this content.
    Also this just adds a blank validation list. After xlValidateList you'll have to add where you'd like to pull the list items from.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Create combobox if left cell has a value

    Untested:


    Please Login or Register  to view this content.
    Also this just adds a blank validation list. After xlValidateList you'll have to add where you'd like to pull the list items from.

  4. #4
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: Create combobox if left cell has a value

    Quote Originally Posted by XeRo Solus View Post
    Untested:


    Please Login or Register  to view this content.
    Also this just adds a blank validation list. After xlValidateList you'll have to add where you'd like to pull the list items from.
    Yep works! I used a Named Range.

    Quick question...earlier on, the user typed in a value in the ComboBox column, and then underlying code on the sheet (Private Sub Worksheet_Change(ByVal Target As Range)) copied this value onto a new sheet.

    Ive noticed that with the combo boxes, the worksheet_change code doesn't seem to have any effect since the cell itself isnt being filled.

    Any ideas on how I can fix that?

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Create combobox if left cell has a value

    Change in a combobox doesn't fire the worksheet_change event. You'll have to use the combobox_change event.

+ 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. Combobox Left Align Text that's too long to fit into cell
    By tigerlilly4321 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2013, 12:08 AM
  2. Replies: 3
    Last Post: 07-01-2013, 11:28 AM
  3. Combobox Text Align left not working
    By Schwizer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2013, 01:31 PM
  4. How to get the Cursor always SET on the extreme left in a ComboBox?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2011, 04:51 PM
  5. How to create an error message if cell left blank
    By Jeanne in forum Excel General
    Replies: 8
    Last Post: 06-09-2009, 02:49 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