Help with userform?

  • Thread starter Thread starter Greg B
  • Start date Start date
G

Greg B

I have a userform with a listbox and a couple of textbox's

I want to have a macro that will lookup the name in the listbox on a sheet
called "reg" and have textbox1 add its amount to the amount in column e and
textbox2 add its total to column f on the same row.

Thanks

Greg
 
Dim iPos as long

Set rng = worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value,
On Error Goto 0
If iPos > 0 Then
worksheets("Sheet1").Cells(iPos,"E").Value = _
worksheets("Sheet1").Cells(iPos,"E").Value + Textbox1.Text
worksheets("Sheet1").Cells(iPos,"F").Value = _
worksheets("Sheet1").Cells(iPos,"F").Value + Textbox2.Text
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Thanks for that will give it a go

Greg
Bob Phillips said:
Dim iPos as long

Set rng = worksheets("Sheet1").Range("A1:A10")
On Error Resume Next
iPos = Application.Vlookup(Listbox1.Value,
On Error Goto 0
If iPos > 0 Then
worksheets("Sheet1").Cells(iPos,"E").Value = _
worksheets("Sheet1").Cells(iPos,"E").Value + Textbox1.Text
worksheets("Sheet1").Cells(iPos,"F").Value = _
worksheets("Sheet1").Cells(iPos,"F").Value + Textbox2.Text
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Back
Top