View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Non-Contiguos Range Iteration

Sub AABBCC()

Dim rng As Range, rng1 As Range
Dim i As Long, cell As Range
Set rng = Range("J313:L315,T313:U315")

For i = 313 To 315
Set rng1 = Intersect(Rows(i), rng).Cells
rng1.ClearContents
For Each cell In rng1
If cell.Address = rng1(1).Address Then
cell.Value = 1
Else
cell.Value = Application.Sum(rng1)
End If
Next
Next

End Sub

--
Regards,
Tom Ogilvy
"Matthew Wieder" wrote in message
...
That's fine. We can assume it's a sum of all of that rows cells in that
range to the left of teh current cell.

Tom Ogilvy wrote:
Should we just make up how its value is calculated - as long as it uses

the
values of other cells in the row?