Hi,
I would like to ask you how to use multiple do while or if there is another way how to automate this type of calculation.
I have worksheet with closing prices of stocks named Closed. On another sheet called Returns i would like to calculate returns. I do not know how many rows and columns will be in Closed.
So i wrote macro for first column.
Sub CalcReturns()
' CalcReturns
Dim row As Integer
Worksheets("Returns").Activate
row = 3
Do While Cells(row, 1) <> ""
Cells(row, 2).Value = Worksheets("Close").Cells(row, 2).Value / _
Worksheets("Close").Cells(row - 1, 2).Value - 1
row = row + 1
Loop
End Sub
My question is how to add second loop for doing above calculation so far as data are in columns of first row.
I tried to study using of loops, but i was able to do just one, not multiple :S Thanks in advance!
I would like to ask you how to use multiple do while or if there is another way how to automate this type of calculation.
I have worksheet with closing prices of stocks named Closed. On another sheet called Returns i would like to calculate returns. I do not know how many rows and columns will be in Closed.
So i wrote macro for first column.
Sub CalcReturns()
' CalcReturns
Dim row As Integer
Worksheets("Returns").Activate
row = 3
Do While Cells(row, 1) <> ""
Cells(row, 2).Value = Worksheets("Close").Cells(row, 2).Value / _
Worksheets("Close").Cells(row - 1, 2).Value - 1
row = row + 1
Loop
End Sub
My question is how to add second loop for doing above calculation so far as data are in columns of first row.
I tried to study using of loops, but i was able to do just one, not multiple :S Thanks in advance!