Hello,
I have the code below to get the lookup amount of the selected client from sheet5, but I don't know what I did wrong since it's not showing the amount on the "txtTotal, can you please help me to get the amount of the selected client?
Note: the Amounts on column "D" contains formulas
<tbody>
</tbody>
I have the code below to get the lookup amount of the selected client from sheet5, but I don't know what I did wrong since it's not showing the amount on the "txtTotal, can you please help me to get the amount of the selected client?
Note: the Amounts on column "D" contains formulas
Code:
Private Sub cmdContact_Click()
On Error Resume Next
If WorksheetFunction.CountIf(Sheet5.Range("B:B"), Me.cboName.Text) = 0 Then
MsgBox "This client is not exist"
Me.cboName.Value = "Cash Client"
Exit Sub
End If
With Me
.txtTotal.Value = Application.WorksheetFunction.VLookup(Me.cboName.Text, Sheet5.Range("A1").CurrentRegion, 4, 0)
End With
End Sub
A | B | C | D | |
1 | ID | Name | Phone | Amount |
2 | 100 | Cash Client | 2000 | |
3 | 101 | Nadim | 3000 | |
4 | 102 | Rami | 4000 |
<tbody>
</tbody>