Simple VBA Range Selection

Gian624

Board Regular
Joined
Jul 23, 2009
Messages
92
Hi Mr. Excel Family,

I know I am overthinking this and its probably simple so here goes:

I am trying to set "ChartRange" as a range that includes cells H5:K5 and everything below as the range of cells to use in a chat. For some reason, I can't figure out how to select the original range and then the range below. The current broken code I have is:

Set ChartRange = Range(("H5:K5"), Range(Selection, Selection.End(xlDown)).Select

Thanks for the help,
Matt
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try
Code:
Set ChartRange = Range("H5:K" & Cells(5, "K").End(xlDown).Row)
 
Upvote 0
A couple of other options

Set ChartRange = Range("H5:K5", Range("H5:K5").End(xlDown))

Or

If the adjacent cells do not contain information:

Set ChartRange = Range("H5:K5").CurrentRegion
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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