I want to select the range starting from the active cell down to the next non-blank cell but stopping three cells before the bottom.
If I record a macro with the keyboard sequence Shift-End, Shift-Down, Shift-Up, Shift-Up, Shift-Up the recorded VBA is
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Range("A1:A32").Select
The problem is that the length of the range is hard-coded.
If I try
Range(Selection, Selection.End(xlDown)).Select
Selection.Resize(numRows - 3, numColumns).Select
VBA throws an "Application-defined or object-defined error" (Run-time error '1004') at the Resize line.
numRows
andnumColumns
? – BigBen