Solved

Select column A through Q down to last used row

Posted on 2013-06-03
2
368 Views
Last Modified: 2013-06-03
In VBA I need to be able to select from column A through column Q, then down to the last used row.  I tried using:
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
But the problem is sometimes not all of the columns are populated, so it does not include all of the columns.  Column A and column Q always have data in them.

Thank you in advance for you assistance.
0
Comment
Question by:jmkbrown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39216920
Try

Range("A1:Q" & Range("A:Q").Find("*", Range("A1"), , , , xlPrevious).Row).Select
0
 

Author Closing Comment

by:jmkbrown
ID: 39216941
This works perfectly!  Thank you very much!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel formula based on 2 different filters 4 42
create different version if file exists 1 39
Excel Date Question 8 41
copy down array 24 26
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

739 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