MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Range Selection


Posted by Rob on December 21, 2001 12:53 AM

I want to specify a range in a Macro using a count variable so I can delete a some cells. I know where the first cell will be but I won't know where the last cell in the range will be so I've set up a count that works down to the last cell and send the number of rows back to the variable I then want to say select e.g. A5:P(Count) any ideas, grateful for any help.


Posted by Paul Akkermans on December 21, 2001 1:10 AM


Hi,

Sub Test()

Dim sRange As Variant

Count = Range("A12").Value 'Value of count in cell A12

sRange = "A5:P" & Count
Range(sRange).Select

End Sub


Posted by Rob A on December 21, 2001 1:29 AM

Thanks, just what I needed to know.