problem advanced filter on userform based on multiple combobox

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
909
Office Version
  1. 2010
hello
i face two problem first the combobox not populate data rowsource despite the same code with a little difference just change the column and the name combobox
the second when i choose item any combobox or toghether the summing values don't change it stay one fixing value
theses my code:
VBA Code:
Private Sub ComboBox3_Change()

Dim i, x As Integer

Dim mylist As String

With Me.ListBox1

For i = 1 To .ListCount - 1

For x = 1 To .ListCount - 1

If .List(x, 2) = Me.ComboBox3 Then

For c = 0 To 6

mylist = .List(x, c)

.List(x, c) = .List(i, c)

.List(i, c) = mylist

Me.ListBox1.Selected(i) = True

Next c

End If

Next x

Next i

Dim m As Integer

Dim sum, sum1 As Double

For m = 1 To .ListIndex()

sum = sum + Val(.List(m, 3))

sum1 = sum1 + Val(.List(m, 4))

Next m

Me.TextBox1 = Format(sum1, "####.00")

Me.TextBox2 = Format(sum, "####.00")

End With

End Sub

this line If .List(x, 2) = Me.ComboBox3 i change in combobox1,2 =If .List(x, 0) = Me.ComboBox1 & If .List(x, 1) = Me.ComboBox2
they works but with combobox 3 not
i hope somebodey help
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Watch MrExcel Video

Forum statistics

Threads
1,118,269
Messages
5,571,227
Members
412,372
Latest member
JON_ROCKS
Top