Solved

combobox change event triggers itself

Posted on 2013-11-08
3
324 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 45

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 45

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Manipulate Data Quickly 2 15
+1 to an even value 4 15
MIN, using ARRAY 4 17
Macro Filter fix 3 13
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

12 Experts available now in Live!

Get 1:1 Help Now