Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selection multiple ranges with Cells property | Excel Programming | |||
Select multiple ranges of data | Excel Programming | |||
select multiple ranges in formula | Excel Discussion (Misc queries) | |||
How to select multiple ranges in Excel with vbs | Excel Programming | |||
Using Select with Range.Cells property | Excel Programming |