Good afternoon everyone. I have a macros which goes to a certain cell, and selects all the active cells to the right and below in the certain table.
the goal is that it selects everything in that range and then colors the cells based on criteria.
its been working fine for the most part with my reports, however, in one of my reports, I noticed when the table has only one row of data, this function selects all the rows to the right in the table, but it selects all the rows to infinity below instead of just in the table
is there a way to fix it so that it selects only the cells in the table,
or is there a way for me to put an if else loop, where "if the table has one row of data, then only select to the right, else if greater than 1, select to the right and down"
thanks
Code:
Range(ActiveCell, Cells(ActiveCell.End(xlDown).Row, ActiveCell.End(xlToRight).Column)).Select
the goal is that it selects everything in that range and then colors the cells based on criteria.
Code:
For Each cl In Range(ActiveCell, Cells(ActiveCell.End(xlDown).Row, ActiveCell.End(xlToRight).Column))
If cl >= Cells(cl.Row, "E") Then
cl.Interior.Color = 5287936
End If
Next cl
its been working fine for the most part with my reports, however, in one of my reports, I noticed when the table has only one row of data, this function selects all the rows to the right in the table, but it selects all the rows to infinity below instead of just in the table
is there a way to fix it so that it selects only the cells in the table,
or is there a way for me to put an if else loop, where "if the table has one row of data, then only select to the right, else if greater than 1, select to the right and down"
thanks
Last edited: