+ Reply to Thread
Results 1 to 2 of 2

Change ComboBox Value on Cell Change

  1. #1
    Registered User
    Join Date
    08-17-2009
    Location
    Arlington, Virginia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Change ComboBox Value on Cell Change

    Hi,

    I'm trying to setup a simple macro that will change the value of a combobox when the cell next to it is changed by the user (the simple combobox, not the one created using UserForms). This code here worked for a second - it set the value of the ComboBox back to 1, but then the ComboBox was stuck and would not change values if a new item was selected. Then it just stopped running. Can anyone make a suggestion as to what I'm doing wrong?

    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = True
    If Intersect(Target, Range("B9")) Is Nothing Then
    Exit Sub
    Else
    ActiveSheet.Shapes("Combo1").ControlFormat.Value = 1
    End If
    Application.EnableEvents = False
    End Sub

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Change ComboBox Value on Cell Change

    Hi, With out trying you code, it looks like you have the "EnableEvents" round the wrong way The code is now set to "False".
    You need to run a bit of code with The "EnableEvents" set to "True",
    and alter your code.
    Mick

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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