Solved

Find out Excel active range?

Posted on 1998-06-16
4
253 Views
Last Modified: 2012-05-04
I'm trying to write an Excel macro to show percentage deviation from a certain amount.

The macro should operate only on a range of cells which the user has selected in a worksheet. I know how to find out which worksheet is active, and which single cell ("ActiveCell" reference) - but how do I find out which  _range_ of cells is selected when the user clicks the button to run the macro ?

The ideal code snippet would do the following:

     Find active range
     Perform any cell-by-cell operation on cells in that range

I was hoping that I could refer to "ActiveRange", but that doesn't exist !

I'm interested in any answer, but particularly a solution that would work on Excel 7.0 (Office 95).  Please supply me with a working example of the code if possible. I'm new to Experts Exchange, so if you think the points should be higher let me know.

thanks  a lot,

Ernesto Orega



0
Comment
Question by:cpdata
  • 3
4 Comments
 
LVL 3

Accepted Solution

by:
shalbe earned 100 total points
ID: 1609767
Ernesto,

Use "selection" as follows to get the address of a selection set.  

 myRange = Selection.Address
    MsgBox myRange

Steve
0
 
LVL 3

Expert Comment

by:shalbe
ID: 1609768
If you need more help in how to apply it, let me know and I'll help you.
0
 

Author Comment

by:cpdata
ID: 1609769
your code does exactly what I was after - thanks a lot !

Ernesto
0
 
LVL 3

Expert Comment

by:shalbe
ID: 1609770
Glad I could help Ernesto. Thanks for the points.

Steve
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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 …
Outlook Free & Paid Tools
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

758 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

16 Experts available now in Live!

Get 1:1 Help Now