Range Select Question

ezywrap

New Member
Joined
Dec 15, 2005
Messages
5
Quick Question

I'm trying to select a range on a worksheet

Range("A4:BL4").Select

The above will work but I can't get the syntax correct for the code below. I'm getting an error

Runtime error 1004
Method 'Range" of object '_Global' failed

Range("'A' & y & ':BL' & y").Select

Can someone point me in the right direction ?

Thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Why the single quotes?

Try this.
Code:
Range("A" & y & ":BL" & y).Select
By the way you don't normally need to use select when working with ranges.
 
Upvote 0
Thanks that worked

You mentioned not using Select. What would be the alternative? Would something else be faster?

I'm only selecting these columns if a condition is met and pasting them into another sheet

Thanks
 
Upvote 0
Well it really depends on the rest of your code.
Code:
Worksheets("Sheet1").
Range("A" & y & ":BL" & y).Copy Worksheets("Sheet2").Range("A1")
Also if this condition is based on a value in a cell you could use filtering.
 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,818
Members
448,990
Latest member
rohitsomani

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