View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Greg B[_7_] Greg B[_7_] is offline
external usenet poster
 
Posts: 10
Default Help with code please

Thank you both for the help it works great.

Greg
"Rick Hansen" wrote in message
...
Hello Greg,
Give this code a shot, and see if it does what your looking for. I run
this example code from a UserForm using a CommandButton1, ComboBox1,
TextBox1. If you have any questions, feel free to ask.

Enjoy, Rick


Option Explicit
Private Sub CommandButton1_Click()
Dim ws1 As Worksheet
Dim r As Integer

Set ws1 = Worksheets("Sheet1")
r = 3 '' start row

'' Find Name in Column "A" Sheet1
Do Until IsEmpty(ws1.Cells(r, "A"))
If Me.ComboBox1 = ws1.Cells(r, "A") Then
ws1.Cells(r, "B") = ws1.Cells(r, "B") + CInt(Me.TextBox1)
Exit Sub '' name found, let exit sub
End If
r = r + 1 '' next row

Loop

End Sub



"Greg B" wrote in message
...
I am looking for help with a macro.

I have a userform where I use combobox1 to select the person I need. I

need
the macro to lookup the matching value in combobox1 to the value selected
from column A.
then using code, I wish to add the value of textbox1 to the value of the
cell in column b and have the total of the two be laced in that cell.

for example i have

combobox1 value = greg

textbox1 = 5



column a column b
greg 3


I would like for column b to change to 8


How would I do that?


Thanks Greg