Setting var to selected Range

  • Thread starter Thread starter El Bee
  • Start date Start date
E

El Bee

I discovered the following statement
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

now I want to set a var to the selected range.

Can anyone help; this VB stuff is all new to me and I really appreciate the
help I have received from many of the Guru's on this site!!!

Thanks again for your time and knowledge.

El Bee
 
dim myRng as range
set myrng = Range(Selection, ActiveCell.SpecialCells(xlLastCell))

or after your last line:

set myrng = selection
 
El Bee

Dim MyRange As Range

Now at the point where you want to capture the range, do this statement:
Set MyRange = Range(Selection, ActiveCell.SpecialCells(xlLastCell))

Now range MyRange will be the cells indicated by your statement
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top