![]() |
Making macros loop
I have two columns, A and B. Column A has data, column B contains a formula.
I want the formula in column B to loop down the rows (ie: B1, B2, B3 etc) until it reaches a blank in column A. I have tried Do Loop...While but I cannot make the loop work. Can anyone help with this? Many thanks. Collins |
Making macros loop
One way:
Public Sub InsertFormula() Const sFORMULA As String = "=SUM($A$1:A1)" Range("A1:A" & Range("A" & Rows.Count).End( _ xlUp).Row).Offset(0, 1).Formula = sFORMULA End Sub In article , McKCollins wrote: I have two columns, A and B. Column A has data, column B contains a formula. I want the formula in column B to loop down the rows (ie: B1, B2, B3 etc) until it reaches a blank in column A. I have tried Do Loop...While but I cannot make the loop work. Can anyone help with this? Many thanks. Collins |
Making macros loop
might be quicker. If more than one, look in vba help for FIND and FINDNEXT.
Example shown Sub looptillblank() x = Columns(1).Find("").Address MsgBox x End Sub -- Don Guillett SalesAid Software "McKCollins" wrote in message ... I have two columns, A and B. Column A has data, column B contains a formula. I want the formula in column B to loop down the rows (ie: B1, B2, B3 etc) until it reaches a blank in column A. I have tried Do Loop...While but I cannot make the loop work. Can anyone help with this? Many thanks. Collins |
All times are GMT +1. The time now is 05:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com