Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a range of celss relative to a single cell 1

Status
Not open for further replies.

apkohn

Technical User
Nov 27, 2000
62
AU
I would like to use a function similar to offset, that will be able to refer to a range of cells, in a relative position to a single cell. The offset function itself does not allow reference to the destination range being different size to the original.

eg, the current range is A1, I want to be able to make the range B1:D1, and then merge these cells. I would like to do this without using range.select calls if possible.

Any ideas?
 
The following expression returns a Range object covering B1:D1, starting with cell A1:
Code:
    ActiveSheet.Range("A1").Offset(0, 1).Resize(1, 3)
First you use Offset to move the range to the starting cell, then you use Resize to change the extent of the range.

If by "merge these cells" you mean you really want to merge them just add ".Merge" to the end of the expression. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top