View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] patrice.cezzar@gmail.com is offline
external usenet poster
 
Posts: 3
Default loop through cells in a range and pick up corresponding cell value

OK, never mind. First of all, thanks JMD - your Sub test2() will work
for what I'm doing.

BUT... I was sure I had done this before. I couldn't remember where,
and I couldn't remember how. Today, I finally found it. I used the
"Item" method, as below. Is there any reason you know of that this
wouldn't be reliable?


Sub runSummary()

cellCount = [rateMatrix].Cells.Count

For counter = 1 To cellCount
' update the assumptions from my input grids:
[cellRate].value = [rateMatrix].Item(counter).Value
[cellNCL].value = [nclMatrix].Item(counter).Value * 100
[cellSize].value = [lineSizeMatrix].Item(counter).Value
[cellExp].value = [loanExpMatrix].Item(counter).Value

' populate the results matrix:
[roecMatrix].Item(counter).Value = [roecLOL].Value

Next counter

End Sub