Solved

combobox change event triggers itself

Posted on 2013-11-08
3
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 47

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 47

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
Outlook Free & Paid Tools
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

737 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