Solved

range xldown &xright

Posted on 1998-12-03
2
920 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How many times recently have you prepared a presentation or emailed a document to a client and you have found that they have older versions of MS Office and they can not open the file you have prepared.  Although most visitors to this site are exper…
Some time ago I was asked to create a VBA function that would calculate a check digit for an input number, using the following procedure: First, sum up all the individual digits in the number If that sum value has more than one digit, then sum up …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now