This code moves down column A to the end of the list. (This code
assumes that each cell in column A contains an entry until the end.)
Sub Test2() ' Select cell A2, *first line of data*. Range("A2").Select ' Set Do loop to stop when an empty cell is reached. Do Until IsEmpty(ActiveCell) ' Insert your code here. ' Step down 1 row from present location. ActiveCell.Offset(1, 0).Select Loop End Sub
Note:- If there are empty cells in column A throughout the data,
modify this code to account for this condition. Make sure that the empty cells are
a consistent distance apart. For example, if every other cell in column A is
empty (for example, this situation may occur if every 'record' uses two rows,
with the second row indented one cell), this loop can be modified as follows:
' Set Do loop to stop when two consecutive empty cells are reached. Do Until IsEmpty(ActiveCell) and IsEmpty(ActiveCell.Offset(1, 0)) ' Insert your code here. ' ' Step down 2 rows from present location. ActiveCell.Offset(2, 0).Select Loop
No comments:
Post a Comment