+ Reply to Thread
Results 1 to 5 of 5

Chose a Value in a dropdown List using VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    92

    Chose a Value in a dropdown List using VBA

    Hi,

    Is there a way to select a particular Value from a dropdown list using VB?

    Thankyou

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Chose a Value in a dropdown List using VBA

    Hello tharindudk,

    Yes, you can. The code depends on the type of drop down you have.

    Is it a Forms or ActiveX control?
    Is it linked to a list?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Chose a Value in a dropdown List using VBA

    I assume your dropdown list is on your sheet.

    If so I normally write my prefferred value or text to the cell.

    If my list if names of fruit in cell E2 then
    range("E2").value = "Apple"
    If it is a combobox in a userform then
    userform1.index = 5

  4. #4
    Registered User
    Join Date
    12-04-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Chose a Value in a dropdown List using VBA

    Hi, I am using Data->Data Validation for my drop dow box. When I do
    range("E2").value = "Apple"
    Excel stop working and i have to clost it.

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Chose a Value in a dropdown List using VBA

    I tried it before I posted and it worked ok here.

    Check to see if you have spaces or periods in the validation box or in the text you use to set it.

+ 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. Replies: 0
    Last Post: 02-21-2013, 09:53 AM
  2. Replies: 21
    Last Post: 12-02-2009, 03:27 PM
  3. Date dropdown list and a Time dropdown list in outlook
    By L_ter in forum Outlook Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2009, 02:33 AM
  4. Replies: 9
    Last Post: 08-05-2008, 09:25 AM
  5. Replies: 4
    Last Post: 04-07-2005, 02:06 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