Cell selection code

T

ToddG

I have the following code to select two cells:

Set rng2 = Range(cell.Offset(0, 0).Address & ":" & _
cell.Offset(0, -1).Address)
If rng1 Is Nothing Then
Set rng1 = rng2
Else
Set rng1 = Union(rng1, rng2)
End If
End If

Next cell

This code selects a cell and the cell to its left. I also
need to select the cells one row up and one column to the
right of this cell (3 cells). I think that this code would
work for the second part of the selection I need:

Set rng2 = Range(cell.Offset(1, 1).Address & ":" & _
cell.Offset(1, 4).Address)

Is there a way to combine this line with my first code
example to be able to select all of these cells at the
same time?

Any advice would be appreciated
 
D

Don Guillett

have a look at RESIZE
cells(1,1).resize(-4,3)
as an example for 4up and 3 to the right
 
A

Alan Beban

Don said:
have a look at RESIZE
cells(1,1).resize(-4,3)
as an example for 4up and 3 to the right
Perhaps it would be helpful if the OP eliminated some confusion and gave
us an example of what is to be accomplished, including an illustration
of the base cell and the desired selection.. The above, for example,
appears to be trying to refer to something "above" Cell A1.

Alan Beban
 

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

Similar Threads


Top