[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Find out Excel active range?

Posted on 1998-06-16
4
Medium Priority
?
260 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
[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
  • 3
4 Comments
 
LVL 3

Accepted Solution

by:
shalbe earned 400 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

Independent Software Vendors: 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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
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…
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: …

650 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