Good Morning,
I have the following code:
My "rRow"'s purpose is to find row numbers where Me.Salenumber.Value = a value inserted in my userform.
Upon updating, I then want another userfield within the userform to display the total value of the sale, which is in row 6.
As an example of this, I have put
As I'm sure you're aware, this is not a valid formula. I was just looking for some direction as to how I could rectify this.
Best Regards
Ralph
I have the following code:
Code:
Private Sub SaleNumber_AfterUpdate()
Dim jRow As Range
Dim xRow As Range
Dim rRow As Ranges
Dim ws As Worksheet
Set ws = Worksheets("Sales")
Set jRow = Sheets("Sales").Range("$B:$B").Rows.Find(what:=Me.SaleNumber.Value, LookIn:=xlFormulas, lookat:=xlWhole)
Set rRow = Sheets("Sales").Range("$B:$B").Rows.Find(what:=Me.SaleNumber.Value, LookIn:=xlFormulas, lookat:=xlWhole)
If jRow Is Nothing Then
'empty
Me.SaleNumber.SetFocus
MsgBox "This is not a valid sale number"
Exit Sub
Else
Me.SaleDate.Value = ws.Cells(jRow.Row, 4)
Me.cID.Value = ws.Cells(jRow.Row, 3)
Me.Amount.Value = Sum(ws.Cells(rRow.Row, 6))
End If
End Sub
Upon updating, I then want another userfield within the userform to display the total value of the sale, which is in row 6.
As an example of this, I have put
Code:
Me.Amount.Value = Sum(ws.Cells(rRow.Row, 6))
Best Regards
Ralph