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
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