Odd Select Range request.  Select cell and XLDown as long as value is in Column B?

Posted on 2016-11-03
Medium Priority
Last Modified: 2016-11-03
I have an odd request.  I need to copy a range from an active sheet that starts at cell A2 and goes down as long as there is a value in column B, but goes out to column K.  Can this be done in Excel vba?  Please advise and thanks.
Question by:RWayneH
  • 2
LVL 35

Accepted Solution

Subodh Tiwari (Neeraj) earned 2000 total points
ID: 41872849
Try like this.....
Dim lr As Long
lr = Cells(Rows.Count, 2).End(xlUp).Row
Range("A2:K" & lr).Copy

Open in new window


Author Closing Comment

ID: 41872872
Worked perfectly.  Thanks for the help.
LVL 35

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41872879
You're welcome. Glad to help.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In this article, I will demonstrate that how to do a PST migration from Exchange Server to Office 365. This method allows importing one single PST, or multiple PST's at once.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question