Private Sub UserForm_Initialize()
Sheet1.Range("V2:Z2").ClearContents
myFilter
Row_Sources
End Sub
Private Sub cmb1_Change()
Sheet1.Range("v2") = Me.cmb1.Value
myFilter
Row_Sources
End Sub
Private Sub cmb2_Change()
Sheet1.Range("w2") = Me.cmb2.Value
myFilter
Row_Sources
End Sub
Sub Row_Sources()
cmb1.RowSource = ""
Me.cmb1.List = Application.Range("rsCombo1").Value 'Run time error 381: Could not set the List property. Invalid property array index
cmb2.RowSource = ""
Me.cmb2.List = Application.Range("rsCombo2").Value
End Sub
Sub myFilter()
Application.ScreenUpdating = False
Dim ws As Worksheet
Set ws = Sheet1
'ws.Cells(2, 11).CurrentRegion.Offset(1, 0).ClearContents ' Unable to get the currentregion property of the Range class
'ws.Range("K2").CurrentRegion.Offset(1, 0).ClearContents ' Unable to get the currentregion property of the Range class
'Range("K2").CurrentRegion.Offset(1, 0).ClearContents ' Unable to get the currentregion property of the Range class
' Range("K2:O1000") = "" ' Unable to get the currentregion property of the Range class. Also clears the combobox
'Unable to get the currentregion property of the Range class
ws.Range("B1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=ws.Range("V1:Z2"), _
CopyToRange:=ws.Range("K1:O1"), Unique:=False
'AdvancedFilter Method of the Range Class failed
'ws.Range("A1:E1000").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=ws.Range("V1:Z2"), _
CopyToRange:=ws.Range("K1:O1"), Unique:=False
With ws ' Removes duplicates to get new Row Sources for Combo Boxes
.Range("K1:K1000").RemoveDuplicates Columns:=1, Header:=xlYes
.Range("L1:L1000").RemoveDuplicates Columns:=1, Header:=xlYes
.Range("M1:M1000").RemoveDuplicates Columns:=1, Header:=xlYes
.Range("N1:N1000").RemoveDuplicates Columns:=1, Header:=xlYes
.Range("O1:O1000").RemoveDuplicates Columns:=1, Header:=xlYes
End With
Application.ScreenUpdating = True
End Sub