Split Range in VBA

Krispy

Board Regular
Joined
Feb 12, 2009
Messages
84
I would like to select a split range to apply formatting with a macro

eg: Range(A1:B9, H1:J9)

My problem is that my current code selects all cells inbetween

eg: Range(A1:J9)

This is the line in question ...

Code:
' Define Report Area to be formatted
Set FormatRng = Range(Range(Cells(Equal.Row, Equal.Column), Cells(Equal.Row + RowCount, Equal.Column)), _
Range(Cells(NotEqual.Row, NotEqual.Column), Cells(NotEqual.Row + RowCount, NotEqual.Column)))

Looking forward to your suggestions :)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi, This might help:-
Code:
Dim rng As Range
Set rng = Union(Range("A1:B9"), Range("H1:J9"))
rng.Interior.ColorIndex = 34
MsgBox rng.Address
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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