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 last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
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.
 

ezywrap

New Member
Joined
Dec 15, 2005
Messages
5
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,128
Messages
5,857,531
Members
431,884
Latest member
Gcmoore63

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
Top