For add userform use below...For subtract userform use same but change red + to -
Private Sub CommandButton1_Click()
Dim Chk, i As Long, x As Long, nr As Long: x = 1
Dim Cb1 As String, Cb2 As String, Cb3 As String, Cb4 As String
With sheet1
nr = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
For i = 1 To 2
With .Cells(1).CurrentRegion
Cb1 = Me.Controls("ComboBox" & x): Cb2 = Me.Controls("ComboBox" & x + 1): Cb3 = Me.Controls("ComboBox" & x + 2): Cb4 = Me.Controls("ComboBox" & x + 3)
Chk = Evaluate("=MATCH(""" & Cb1 & """ & """ & Cb2 & """& """ & Cb3 & """& """ & Cb4 & """," & .Columns(1).Address & "&" & .Columns(2).Address & "&" & .Columns(3).Address & "&" & .Columns(4).Address & ",0)")
End With
If Not IsError(x) Then
.Cells(Chk, 5) = .Cells(Chk, 5) + Me.Controls("TextBox" & i)
Else
.Range("A" & nr).Resize(, 5) = Array(Cb1, Cb2, Cb3, Cb4, Me.Controls("TextBox" & i).Value)
End If
x = 5
Next i
End With
End Sub
Bookmarks