Issue with Selection.End(xlDown)

Closed
linda - Jun 9, 2009 at 11:52 AM
rev_do Posts 5 Registration date Sunday March 29, 2009 Status Member Last seen June 12, 2009 - Jun 9, 2009 at 12:46 PM
Hello,
I am working on a few macros and came across this problem. If I use the code below to select a range of cells and if my working rows only have one row, the command selects, in this example, C2 all the way down to the maximum ie. C9999999999. The code halts with an error when it is looping through an infinite (or very large) number of cells. I do not have problems when the data consists of more than one row. I only want to select everything in column C, starting in C2 that has data, not the blank cells below

Range("C2").Select
Range(Selection, Selection.End(xlDown)).Select
For Each Cell In Selection
command
command
command
Next Cell
Related:

1 response

rev_do Posts 5 Registration date Sunday March 29, 2009 Status Member Last seen June 12, 2009 1
Jun 9, 2009 at 12:46 PM
1