ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   repeat macro until empty space in next column (https://www.excelbanter.com/excel-worksheet-functions/105163-repeat-macro-until-empty-space-next-column.html)

Sabba Efie

repeat macro until empty space in next column
 
Assume two columns. I want to perform an operation on a cell in the first
column and then repeat that operation on the cell below as long as there is
at least one character in the second column. When the second column is blank
the operation stops. I set up a macro to perform the operation and move down
one cell. Now I want to check the second column and repeat the macro until a
blank cell is reached.

David Billigmeier

repeat macro until empty space in next column
 
Try something like this... replace ActiveCell.Offset(i,0) = "a" with the
operation you are looking to perform:

Sub repeat()
i = 0
Range("A1").Select
While (ActiveCell.Offset(i, 1) < "")
ActiveCell.Offset(i, 0) = "a"
i = i + 1
Wend
End Sub


--
Regards,
Dave


"Sabba Efie" wrote:

Assume two columns. I want to perform an operation on a cell in the first
column and then repeat that operation on the cell below as long as there is
at least one character in the second column. When the second column is blank
the operation stops. I set up a macro to perform the operation and move down
one cell. Now I want to check the second column and repeat the macro until a
blank cell is reached.



All times are GMT +1. The time now is 11:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com