ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help Please (https://www.excelbanter.com/excel-programming/352177-help-please.html)

Greg B[_7_]

Help Please
 
Could I have some help with this please?
I have been helped with this code to have it add total for certain people i
have in a list but I am stuck on how to get a code to work for the
following:

I want to have the code continue what it has been doing but I also need it
to lookup the value on this persons row in column 19 and only add the data
if it is more than what is already on the spreadsheet.

here is the code so far
Private Sub CommandButton1_Click()
Dim ws1 As Worksheet
Dim r As Integer

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

'' Find Name in Column "A" Sheet1
Do Until IsEmpty(ws1.Cells(r, 1))
If Me.ComboBox1 = ws1.Cells(r, 1) Then
ws1.Cells(r, 2) = ws1.Cells(r, 2) + 1
ws1.Cells(r, 5) = ws1.Cells(r, 5) + CInt(Me.TextBox1)
ws1.Cells(r, 9) = ws1.Cells(r, 9) + CInt(Me.TextBox2)
ws1.Cells(r, 13) = ws1.Cells(r, 13) + CInt(Me.TextBox3)
ws1.Cells(r, 25) = ws1.Cells(r, 25) + CInt(Me.TextBox4)
ws1.Cells(r, 20) = ws1.Cells(r, 20) + CInt(Me.TextBox5)
ws1.Cells(r, 21) = ws1.Cells(r, 21) + CInt(Me.TextBox6)

here is the problem I have tried but failed using this

If TextBox7.Value ws1.Cells(r, 19) Then
ws1.Cells(r, 19) = ws1.Cells(r, 19) = CInt(Me.TextBox7)
End If
Exit Sub '' name found, let exit sub
End If
r = r + 1 '' next row

Loop

End Sub
Thanks

Greg



Tom Ogilvy

Help Please
 


If cLng(TextBox7.Value) ws1.Cells(r, 19) Then
ws1.Cells(r, 19) = ws1.Cells(r, 19) + CLng(Me.TextBox7)
End If




--
Regards,
Tom Ogilvy



"Greg B" wrote in message
...
Could I have some help with this please?
I have been helped with this code to have it add total for certain people

i
have in a list but I am stuck on how to get a code to work for the
following:

I want to have the code continue what it has been doing but I also need

it
to lookup the value on this persons row in column 19 and only add the data
if it is more than what is already on the spreadsheet.

here is the code so far
Private Sub CommandButton1_Click()
Dim ws1 As Worksheet
Dim r As Integer

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

'' Find Name in Column "A" Sheet1
Do Until IsEmpty(ws1.Cells(r, 1))
If Me.ComboBox1 = ws1.Cells(r, 1) Then
ws1.Cells(r, 2) = ws1.Cells(r, 2) + 1
ws1.Cells(r, 5) = ws1.Cells(r, 5) + CInt(Me.TextBox1)
ws1.Cells(r, 9) = ws1.Cells(r, 9) + CInt(Me.TextBox2)
ws1.Cells(r, 13) = ws1.Cells(r, 13) + CInt(Me.TextBox3)
ws1.Cells(r, 25) = ws1.Cells(r, 25) + CInt(Me.TextBox4)
ws1.Cells(r, 20) = ws1.Cells(r, 20) + CInt(Me.TextBox5)
ws1.Cells(r, 21) = ws1.Cells(r, 21) + CInt(Me.TextBox6)

here is the problem I have tried but failed using this

If TextBox7.Value ws1.Cells(r, 19) Then
ws1.Cells(r, 19) = ws1.Cells(r, 19) = CInt(Me.TextBox7)
End If
Exit Sub '' name found, let exit sub
End If
r = r + 1 '' next row

Loop

End Sub
Thanks

Greg






All times are GMT +1. The time now is 02:07 PM.

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