Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Select multiple ranges using cells property

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Select multiple ranges using cells property

Try the below...


intRows = 10

Range(Range(Cells(5, 4), Cells(intRows, 5)).Address & "," & _
Range(Cells(5, 6), Cells(intRows, 7)).Address).BorderAround Weight:=xlThin

--
Jacob


"Spike" wrote:

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Select multiple ranges using cells property

spot on. Many thanks much appreciated
--
with kind regards

Spike


"Jacob Skaria" wrote:

Try the below...


intRows = 10

Range(Range(Cells(5, 4), Cells(intRows, 5)).Address & "," & _
Range(Cells(5, 6), Cells(intRows, 7)).Address).BorderAround Weight:=xlThin

--
Jacob


"Spike" wrote:

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Select multiple ranges using cells property

When you have more ranges; to be selected dynamically ..you should be able to
have a loop to build the address string..separated by comma and then use that
with Range() as below

strAddress = "D5:E10,F5:G10,..,..,..,.."
Range(strAddress).Select


--
Jacob


"Jacob Skaria" wrote:

Try the below...


intRows = 10

Range(Range(Cells(5, 4), Cells(intRows, 5)).Address & "," & _
Range(Cells(5, 6), Cells(intRows, 7)).Address).BorderAround Weight:=xlThin

--
Jacob


"Spike" wrote:

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Select multiple ranges using cells property

how do i select two individual cells using the cells propertly to format in
the same way.
ie Range (Cells(5, 4) and
Range(Cells(5, 5)

so that i get a border line around each one

--
with kind regards

Spike


"Spike" wrote:

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Select multiple ranges using cells property

Try

Range(Cells(5, 4).Address & "," & Cells(5, 5).Address).BorderAround _
Weight:=xlThin

--
Jacob


"Spike" wrote:

how do i select two individual cells using the cells propertly to format in
the same way.
ie Range (Cells(5, 4) and
Range(Cells(5, 5)

so that i get a border line around each one

--
with kind regards

Spike


"Spike" wrote:

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Select multiple ranges using cells property

thanks. That was the one combination i had not tried!
--
with kind regards

Spike


"Jacob Skaria" wrote:

Try

Range(Cells(5, 4).Address & "," & Cells(5, 5).Address).BorderAround _
Weight:=xlThin

--
Jacob


"Spike" wrote:

how do i select two individual cells using the cells propertly to format in
the same way.
ie Range (Cells(5, 4) and
Range(Cells(5, 5)

so that i get a border line around each one

--
with kind regards

Spike


"Spike" wrote:

I will be very grateful for the code to select two ranges at the same time.
I am formatting these ranges with borders etc and rather than do each one in
turn would like to do them at the same time. The two ranges are as below.

Range(Cells(5, 4), Cells(intRows, 5))

Range(Cells(5, 6), Cells(intRows, 7))

Everything I have tried selects the whole area and not separately, using D5
etc is simple but as this is dynamic I need to use the Cells property

many thanks
--
with kind regards

Spike

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
Selection multiple ranges with Cells property carmjo005 Excel Programming 4 April 1st 09 11:44 PM
Select multiple ranges of data [email protected] Excel Programming 4 July 31st 08 05:25 PM
select multiple ranges in formula dschanak Excel Discussion (Misc queries) 2 June 6th 07 04:53 PM
How to select multiple ranges in Excel with vbs Stefan Mueller Excel Programming 9 May 4th 05 04:55 PM
Using Select with Range.Cells property Ralph Heidecke Excel Programming 2 January 15th 05 03:05 PM


All times are GMT +1. The time now is 10:19 PM.

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

About Us

"It's about Microsoft Excel"