J
Joanne
WinXP Pro, MSOffice 2003
Debbie from this group gave me this sub routine to cause cell in "D" to
= 65 if cell in "C" is > 0 but it doesn't work. So I added the first 4
lines, hoping that would help (from an example from a different sub
routine I had received help on), but now when I F8, I am getting the
variable not defined error and the word 'lists' in row 5 is highlighted.
Lists is the name of the ws I want this to act on
The range will always be rows 15 thru 65 inclusive, so I know that could
be hardcoded in the sub, but my questions are is it a good idea to do
that, and if so, what changes do I need to make to stop the row count?
Would For i - 15 to 65 be the correct syntax?
Sub LaborRate()
On Error Resume Next
Dim ws As Worksheet
Dim i As Integer
Set ws = Worksheets("lists")
For i = 15 To Sheets(lists).Cells(Rows.Count, "C").End(xlUp).Row
If Sheets(lists).Cells(i, "C").Value > 0 Then
Sheets(lists).Cells(i, "D").Value = 65
End If
Next
End Sub
I can't figure out what it wants. I thought that line 5 was setting the
variable - is that different from declaring it. If so, how do I declare
it so that this will work for me?
I sure appreciate your time and help on this - it seems to me a simple
thing and is kind of making me crazy that I cannot get it to go even
though I got some expert help on it.
Thanks
Joanne
Debbie from this group gave me this sub routine to cause cell in "D" to
= 65 if cell in "C" is > 0 but it doesn't work. So I added the first 4
lines, hoping that would help (from an example from a different sub
routine I had received help on), but now when I F8, I am getting the
variable not defined error and the word 'lists' in row 5 is highlighted.
Lists is the name of the ws I want this to act on
The range will always be rows 15 thru 65 inclusive, so I know that could
be hardcoded in the sub, but my questions are is it a good idea to do
that, and if so, what changes do I need to make to stop the row count?
Would For i - 15 to 65 be the correct syntax?
Sub LaborRate()
On Error Resume Next
Dim ws As Worksheet
Dim i As Integer
Set ws = Worksheets("lists")
For i = 15 To Sheets(lists).Cells(Rows.Count, "C").End(xlUp).Row
If Sheets(lists).Cells(i, "C").Value > 0 Then
Sheets(lists).Cells(i, "D").Value = 65
End If
Next
End Sub
I can't figure out what it wants. I thought that line 5 was setting the
variable - is that different from declaring it. If so, how do I declare
it so that this will work for me?
I sure appreciate your time and help on this - it seems to me a simple
thing and is kind of making me crazy that I cannot get it to go even
though I got some expert help on it.
Thanks
Joanne