Greetings,
I'd like to loop a formula across columns and have it stop when it gets to the last column that I have defined. Here is the code:
Just to be clear, the formula would change as the loop goes from column to column. I'm just not sure how to format
to achieve this. Also, I'm not sure if
is a valid end to the loop. I'm open to any other more efficient looping process or way to make any part of the code more efficient. Any help is much appreciated.
Regards,
I'd like to loop a formula across columns and have it stop when it gets to the last column that I have defined. Here is the code:
Code:
Sub LoopAcrossCols()
Dim LastCol As Integer
Worksheets("Sheet1").Activate
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Column = 3
Do
Cells(2, Column).Formula = "=B2+C3"
Row = Row + 1
Loop Until LasCol
End Sub
Just to be clear, the formula would change as the loop goes from column to column. I'm just not sure how to format
Code:
"=B2+C3"
Code:
Loop Until LasCol
Regards,