MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Selecting Cells in A Macro


Posted by Sam on July 09, 2001 10:14 AM

I'm having trouble with a line of code in one of my macros. The code is as follows.

Selection.End(xlUp).Range("A1").Select
Selection.End(xlUp).Range("A1").Select
Selection.Offset(2, 0).Range("A1").Select
Selection.End(xlDown).Select

What I want is for the last line to highlight however many cells it passes over (Usually about 300) until it reaches the end of the section of cells. There is a blank row separating these cells from the data below. I cannot designate an amout because it changes.

Any help would be appreciated.

Thanks,
Sam


Posted by Barrie Davidson on July 09, 2001 10:56 AM

Sam, instead of:
Selection.End(xlDown).Select

try:
Range(ActiveCell, ActiveCell.End(xlDown)).Select

Regards,
Barrie

Posted by Sam on July 09, 2001 11:43 AM

Thanks Barrie Your The Best!