Home > Net >  How to include more than one column within CurrentRegion?
How to include more than one column within CurrentRegion?

Time:09-18

Range("A1").CurrentRegion.Columns(2)  

I understand that this selects column B. How would I set it to column A and B? I've tried 1, 2 and 1:2 and neither work.

Thanks.

CodePudding user response:

If you want to get columns A:B applied to CurrentRegion, the following would suffice in your case (don't forget to fully qualify your range references, e.g. with the project's sheet Code(Name) which might be Sheet1):

Sheet1.Range("A1").CurrentRegion.Resize(,2)

If you want to define another start column as A:A (e.g. the 3rd one) and resize to a double column C:D you might use

Sheet1.Range("A1").CurrentRegion.Columns(3).Resize(,2)

Of course you could play around with Intersect and Index functions, too.

  • Related