Solved

combobox change event triggers itself

Posted on 2013-11-08
3
327 Views
Last Modified: 2013-11-08
Hi

I have set up a combobox with the option to select 'other'. In this case an input box appears and asks the user to enter the name of the business that is not on the list. That name is then added to the combobox linked range so that it now appears in the combobox.

The problem is that the input box appears a second time asking to input the business name.
It is (I think) due to a change in the list that triggers it for the second time (Because simply typing into the combobox linked range also triggers the input box (But I don't want that to happen). After the second time it doesn't happen and everything carries on just fine.

The code attached to the combobox is:

Sub Add_business_name()
 
'the Business Name we want to add
Dim BusinessName As String

'display an input box asking for Business name
BusinessName = InputBox( _
"Type in the name of the Business you want to add, This must MATCH EXACTLY the name of the folder in which the assessment is stored")

'if no Business name added, say so and stop
If Len(BusinessName) = 0 Then
MsgBox "No Business name added"
Exit Sub
End If

'enter Business name into combobox list next blank cell
'Assumes no blank rows within your data
Range("BJ6").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select


End Sub



Any help much appreciated
Dantastico
0
Comment
Question by:dantastico
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39634904
You didn't attach a workbook but putting

Application.EnableEvents = False before the code and Application.EnableEvents = True after it might work
0
 

Author Closing Comment

by:dantastico
ID: 39634928
even though I attached the wrong code (DUH), your instant solution worked a treat!
Should have come to you days ago
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39634961
I've had it happen to me more than once so the answer was easy, but I'll still take the points:) In any case you're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FormulaArray VBA Issue 6 17
Excel VBA When using VLookup 6 26
Most Consistent Performer 4 19
Error in formula not increasing value 2 0
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now