Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

range xldown &xright

Posted on 1998-12-03
2
Medium Priority
?
928 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 600 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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