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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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