I'm new to the Forum. I need assistance with VBA Coding for the following: I have also uploaded the file.
When clicking on "PAYMENTS" in Sheet 1, a userform opens up. If I type in the WO REF NO, info, for that specific client comes up. i.e. 1006
Now I want to enter amount of payment and date of payment and have that specific value be deducted from the Balance of that specific client on Sheet1. so if WO REF NO 1006 is entered, the below code would deduct the payment entered from that specific client . If, however, I chose a different WO REF NO, the code must search the criteria, find the client and deduct payment from that client.
Can anyone assist.
- Code: Select all
Private Sub Payment_Process_Click()
Dim i As Integer
Dim cNum As Integer
Dim X As Integer
Dim nextrow As Range
i = Range("F3").Value
Range("F3") = i - Reg7.Value
cNum = 8
Set nextrow = Sheet2.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0)
For X = 1 To cNum
nextrow = Me.Controls("Reg" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
MsgBox "The data has been sent"
cNum = 8
For X = 1 To cNum
Me.Controls("Reg" & X).Value = ""
Set nextrow = nextrow.Offset(0, 1)
Next
End Sub