abdo meghari
Well-known Member
- Joined
- Aug 3, 2021
- Messages
- 651
- Office Version
- 2019
Hi
I want searching the BRAND in in column E for AS sheet based on selected from combobox1 and if doesn't contain zero in column H then merge duplicates BRAND IN column F in textbox1
the sheet
so when select ID from column E then will merge QTY F in textbox1 if the ID doesn't contain zero in adjacent cell for column H
I have this code to populate the QTY in textbox1 without merge duplicates ID .
I hope some body help
I want searching the BRAND in in column E for AS sheet based on selected from combobox1 and if doesn't contain zero in column H then merge duplicates BRAND IN column F in textbox1
the sheet
AA Microsoft Excel (3).xlsx | ||||||
---|---|---|---|---|---|---|
E | F | G | H | |||
1 | BRAND | QTY | UNIT PRICE | TOTAL | ||
2 | BS 1200R20 G580 JAP | 500 | 1500 | 0 | ||
3 | BS 1200R20 G580 THI | 300 | 1600 | 0 | ||
4 | BS 1200R20 R187 JAP | 150 | 1450 | 0 | ||
5 | BS 1200R24 G580 JAP | 260 | 2000 | 0 | ||
6 | BS 1200R20 G580 JAP | 340 | 1550 | 527000 | ||
7 | BS 1200R20 G580 THI | 800 | 1440 | 1152000 | ||
8 | BS 315/80R22.5 R184 THI | 500 | 1250 | 625000 | ||
9 | BS 1200R20 G580 JAP | 300 | 1600 | 480000 | ||
10 | BS 1200R20 G580 THI | 250 | 1700 | 425000 | ||
AS |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H6:H10 | H6 | =IF(AND(IN!$C$7=C6,ISNUMBER(MATCH($E6,IN!$C$3:$C$300,0))),0,F6*G6) |
so when select ID from column E then will merge QTY F in textbox1 if the ID doesn't contain zero in adjacent cell for column H
I have this code to populate the QTY in textbox1 without merge duplicates ID .
VBA Code:
Private Sub ComboBox1_Change()
Dim c As Range
Dim ws As Worksheet
Set ws = Sheets("AS")
With ws
Set c = .Range("E:E").Find(What:=ComboBox1.Value, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
TextBox1.Value = c.Offset(, 1).Value
End If
End With
End Sub