first of all lets assume I have some data In columns 1 To 3 And need To apply my formula And display the results In column 4 To 6.
therefore my active cell, Or better my starting point Is cell D1.
The first Loop through rows of a single column should be Like this:
Sub Lnreturns()
Range("D1").Select
Do While ActiveCell.Offset(1, -3) <> ""
ActiveCell.Offset(1, 0).Value = WorksheetFunction.Ln _
(ActiveCell.Offset(1, -3) / ActiveCell.Offset(0, -3))
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Now
the Next Step should be To insert a For/Next Loop In order To change column.
like:
For c=1 To 3
Do While ActiveCell.Offset(1, -c) <> ""
Next c
the thing Is that since I am adding And subtracting column To my active cell
I cannot find the right way To use this Loop
Apologies For the lack of elegance In my code.
Ty For your help
|