#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"