Solved

Excel: Calculate a specific range

Posted on 2015-02-24
1
46 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
1 Comment
 
LVL 22

Accepted Solution

by:
rspahitz earned 500 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

743 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

15 Experts available now in Live!

Get 1:1 Help Now