[SOLVE] set 2 cells as a range

phoeberunner

New Member
Joined
May 12, 2011
Messages
16
Hi,

I want to set a range with 2 cells which are not next to each other, here is my code,

Set rng = Range(Cells(10, 5).Address & "," & Cells(10, 8).Address)

It caused error, anyone can solve this?

Thanks,
Phoebe
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Re: set 2 cells as a range

To set a range for E10:H10 try this...

Code:
Set Rng = Range(Cells(10, 5), Cells(10, 8))

...or for just the two cells E10 and H10 your original code is correct (note the ".Address" is needed in this case).

HTH

Robert
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top