Solved

Excel: Calculate a specific range

Posted on 2015-02-24
1
54 Views
Last Modified: 2015-02-24
Experts,

I am using a VLOOKUP in a set of merged cells (C22:K23) to create a brief description. The description changes each time one of 12 cells (E8:E19) are selected. The description goes away when a cell outside of these 12 cells is selected.  I am currently doing this with the Calculate function in the SelectionChange Event. However, now a user can't do anything else on the sheet because of Calculation running every time a new cell is selected.

How can I only Calculate the cell containing the VLOOKUP function?

Thanks, Dale
0
Comment
Question by:dlogan7
[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
1 Comment
 
LVL 22

Accepted Solution

by:
rspahitz earned 500 total points
ID: 40629829
You'll notice that the SelectionChange event has a parameter with it, ByVal Target As Range.  this allows you to find out which cell was selected.  Based on that you can tell it to calculate only if the cell is within the desired range, like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
   If (Target.Row >= 8 Or Target.Row <= 19) And Target.Column = 5 Then ' E8-E19
           ' your existing code
   End If
End Sub

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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 …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

751 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