selecting multiple cells in VBA

W

Woodi2

I am using code on a userform and part of the code finds the last cell used
in row V then selects the cell 9 cells to the left, on this occasion row M,
as follows
Range("v7").Select
Range("V7").End(xlDown).Select
ActiveCell.Offset(0, -9).Select

How I can select the 5 cells to the right and 3 cells down at the same time.
i.e., my code would select cell M3, i then want to highlight M3 to R5. From
there i need to add borders around these cells but I think I can manage that
bit.
Thanks
Ian
 
L

Lars-Åke Aspelin

I am using code on a userform and part of the code finds the last cell used
in row V then selects the cell 9 cells to the left, on this occasion row M,
as follows
Range("v7").Select
Range("V7").End(xlDown).Select
ActiveCell.Offset(0, -9).Select

How I can select the 5 cells to the right and 3 cells down at the same time.
i.e., my code would select cell M3, i then want to highlight M3 to R5. From
there i need to add borders around these cells but I think I can manage that
bit.
Thanks
Ian


Try this modification to your last statement

ActiveCell.Offset(0, -9).Resize(3, 6).Select

Hope this helps / Lars-Åke
 
L

L. Howard Kittle

Something like this?

Range("M3:R5").Select

And then apply your border code.

Try this for your V7 offset selection, it's a bit shorter.

Range("V7").End(xlDown).Offset(0, -9).Select

HTH
Regards,
Howard
 

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

Top