View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
RaY RaY is offline
external usenet poster
 
Posts: 164
Default looping thru rows

Hi Don,
This works if the row count is known. in this case 7; I got my problem
solved with help from Ryan's code. Thanks very much for your help.
Ray

"Don Guillett" wrote:

Try this idea. Notice the dots .......

Function Z_UpdateCell()
With Sheets("ListofDiff")
For i = 2 To 7
If .Cells(i, 10) < 0 Then
.Cells(i, 14) = -.Cells(i, 12)
Else
.Cells(i, 14) = .Cells(i, 12)
End If
Next i
End With
End Function


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ray" wrote in message
...
POSTED: SEARCH - LOOPING, IN EXCEL PROGRAMMING

Hello,

I am trying convert a value of one column (col 12 is value) to negative if
the value in another column (col 10 is cs qty) is negative. The result
would
update to column 14 as - or + value.

The function below works but I cant get it to loop thru the entire rows.
The
amount of records changes daily. I am trying to loop this using do until
but
I cant get it to work. Would you please show me how to get this to loop
thru
the entire rows?

Function Z_UpdateCell()

If Worksheets("ListofDiff").Cells(2, 10) < 0 Then
Worksheets("ListofDiff").Cells(2, 14) = -(Cells(2, 12))
Else: Worksheets("ListofDiff").Cells(2, 14) = (Cells(2, 12))
End If


End Function

thanks, ray


.