Solved

range xldown &xright

Posted on 1998-12-03
2
927 Views
Last Modified: 2006-11-17
How Do I Select A Section Spaning Both Rows And Colunms
Use Macro's
Bad Code:
Sub Macro10()
    Range(ActiveCell, ActiveCell.End(xlDown)).Select
    Range(ActiveCell, ActiveCell.End(xlToRight)).Select
End Sub
0
Comment
Question by:refr
[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 3

Accepted Solution

by:
frazer earned 150 total points
ID: 1614817
Hi,

There are two ways to do this....

The first is....

Sub test()
    Dim Col As Range
    Set Col = Range("A1").End(xlToRight)
    Range("A1", Col.End(xlDown)).Select
End Sub

The other is....

Sub test2()
    Range("B2", Range("B2").SpecialCells(xlCellTypeLastCell)).Select
End Sub

This selects the last cell that has ever been used in the sheet rather than the last currently filled cell.

Hope this helps

Frazer
0
 

Author Comment

by:refr
ID: 1614818
Thank YOu Frazer For Your Double Answer And Promtness.
Well Done.
refr
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

635 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