Combo Box macro issue

vitz_n1

New Member
Joined
Mar 20, 2011
Messages
2
Hi All,

I have a question regarding combo boxes. You'll have to excuse me if this is a very simple issue but im just learning and didnt understand any of the other topics on this.

So basically i have one combo box on one sheet "Team". This box had a macro in it the runs a macro that clear contents, runs an advanced filter and removes duplicates.

Here is the code:

Private Sub ComboBox1_Change()
Sheets("Team").Select
Range("E15").Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("D10:D11").Select
Sheets("Sheet3").Columns("A:N").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("Team!Criteria"), CopyToRange:=Range("D14:E14"), _
Unique:=False
Range("E15").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range("$D$14:$F$176").RemoveDuplicates Columns:=2, Header:= _
xlYes
Range("E13").Select

End Sub

This works perfect.

THEN, i have another combo box on a different sheet "Agent", the fil range of this box is determined by the output of the above advanced filter.
This combo box essentially does the same thing but just now goes down to Agent level. Here is the code:

Private Sub ComboBox2_Change()
Sheets("Agent").Select
Range("E15").Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("C9:C10").Select
Sheets("Sheet3").Columns("A:N").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("Agent!Criteria"), CopyToRange:=Range("Agent!Extract") _
, Unique:=False
End Sub

This also works fine but for some reason, when i go back to select a value from the first combo box it give me a debug error and highlights a line from the second combo box.... i dont know why the second box can error the first...

The first line of code on the combobox2 is the error:

Range("E15").Select


Please help
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top