I'm having trouble with figuring out how to loop through a table of data that has been input.
The goal is to copy two values (Sheet1 A2, C2) from the table, put them on the same place on another table (Sheet 2 $B$3,$B$4), do a quick calculation, and copy the result back to the first table (Sheet1 A5). I have accomplished this for one row, as follows...
...but for the life of me I cannot figure out how to rewrite this so it changes A2, C2, and F2 to be A3, C3, F3, then, A4, C4, F4, etc. until the table ends.
Am I going about this wrong? Any advice would be greatly appreciated. I've been at this for a couple days now with no luck. Thanks in advance!
The goal is to copy two values (Sheet1 A2, C2) from the table, put them on the same place on another table (Sheet 2 $B$3,$B$4), do a quick calculation, and copy the result back to the first table (Sheet1 A5). I have accomplished this for one row, as follows...
Code:
Sub TableMacro()
'Copy cells from first sheet to appropriate place on second sheet
Sheets("SHEET2").Range("B3") = Sheets("SHEET1").Range("A2")
Sheets("SHEET2").Range("B4") = Sheets("SHEET1").Range("C2")
'Run Macro (will put result on sheet 2, cell B10)
CalcMacro
'Copy results back to table on first sheet
Sheets("SHEET1").Range("F2") = Sheets("SHEET2").Range("B10")
End Sub
...but for the life of me I cannot figure out how to rewrite this so it changes A2, C2, and F2 to be A3, C3, F3, then, A4, C4, F4, etc. until the table ends.
Am I going about this wrong? Any advice would be greatly appreciated. I've been at this for a couple days now with no luck. Thanks in advance!