ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with userform? (https://www.excelbanter.com/excel-programming/355527-help-userform.html)

Greg B[_8_]

Help with userform?
 
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




Bob Phillips[_6_]

Help with userform?
 
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)

"Greg B" wrote in message
...
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






Greg B[_8_]

Help with userform?
 
Thanks for that will give it a go

Greg
"Bob Phillips" wrote in message
...
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)

"Greg B" wrote in message
...
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









All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com