Multiple rows select

Philip00

New Member
Joined
Aug 16, 2017
Messages
37
Hi All!

I would like to use multiple rows as range.

I have tried the following code with no luck_

Range("a1:aj1") & ("a3:aj3")

Can you help me with this issue?

Thank you so much in Advance,

Philip
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try:
Code:
Range("A1:AJ1, A3:AJ3")
 
Upvote 0
That would be as follows, but note that you rarely need to select anything to work with it in vba and selecting slows your code.
Code:
Range("a1:aj1,a3:aj3").Select
 
Upvote 0
Thanks Both of you!

Could you also help if i want to use "I" as variable

i have tried like this

Range("a1:aj1, A & i+1: AJ & i+1")
 
Upvote 0
Literal values go between double-quotes, variables do not.
So try:
Code:
Range("A1:AJ1, A" & i & ":AJ" & i)
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,080
Members
453,021
Latest member
Justyna P

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