Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default selecting multiple cells in VBA

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default selecting multiple cells in VBA

On Fri, 28 Aug 2009 21:30:01 -0700, Woodi2
wrote:

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default selecting multiple cells in VBA

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

"Woodi2" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select multiple adjacent cells of multiple cells without selecting sjsjsjsjsjs New Users to Excel 11 December 24th 09 01:09 AM
Select multiple adjacent cells of multiple cells without selecting sjsjsjsjsjs Excel Worksheet Functions 7 December 23rd 09 08:54 PM
Selecting Multiple Cells Richard Stedman Excel Discussion (Misc queries) 3 March 12th 09 10:59 PM
How do I keep from selecting multiple cells Ricochet Excel Worksheet Functions 2 April 29th 08 06:11 PM
How to change shade of cells when selecting multiple cells abrummet Excel Discussion (Misc queries) 3 September 6th 07 11:42 AM


All times are GMT +1. The time now is 07:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"