abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,429
- Office Version
- 2019
- 2010
- Platform
- Windows
hi, all
actually i have a problem when press on of the option button (CODE) OR (ORHIGIN) OR (BRAND )and choose from combobox it doesn't filter data correctly it just filter in row1 and hide the rest of data for instance if i press code and choose from combobox aa1 it just filter one row but it supposes two row and if i press origin it 's filtering wrong just aa1
this is main sheet & userform
this is some results
this when i choose the lastrow in combobox stay filter first row
my codes
actually i have a problem when press on of the option button (CODE) OR (ORHIGIN) OR (BRAND )and choose from combobox it doesn't filter data correctly it just filter in row1 and hide the rest of data for instance if i press code and choose from combobox aa1 it just filter one row but it supposes two row and if i press origin it 's filtering wrong just aa1
this is main sheet & userform
this is some results
this when i choose the lastrow in combobox stay filter first row
my codes
VBA Code:
Private Sub ComboBox1_Click()
Dim I As Long
If Me.OptionButton1.Value = True Then
SHEET1.Range("A2").Value = Me.ComboBox1.Value
ElseIf Me.OptionButton2.Value = True Then
SHEET1.Range("B2").Value = Me.ComboBox1.Value
ElseIf Me.OptionButton3.Value = True Then
SHEET1.Range("C2").Value = Me.ComboBox1.Value
Else
SHEET1.Range("D2").Value = Me.ComboBox1.Value
End If
On Error Resume Next
ActiveSheet.ShowAllData
I = SHEET1.Range("A100000").End(xlUp).Offset(1, 0).Row
SHEET1.Range("A" & 2, "E" & I).AdvancedFilter xlFilterInPlace, SHEET1.Range("A2:E3")
End Sub
Private Sub CommandButton1_Click()
ActiveSheet.ShowAllData
End Sub
Private Sub OptionButton1_Click()
Me.ComboBox1.BoundColumn = 1
End Sub
Private Sub OptionButton2_Click()
Me.ComboBox1.BoundColumn = 2
End Sub
Private Sub OptionButton3_Click()
Me.ComboBox1.BoundColumn = 3
End Sub
Private Sub OptionButton4_Click()
Me.ComboBox1.BoundColumn = 4
End Sub
Private Sub UserForm_Initialize()
Dim r As Range
With Worksheets("Sheet1")
Set r = .Range("A2", .Range("E65536").End(xlUp))
End With
ComboBox1.RowSource = "Sheet1!" & r.Address
End Sub