Solved

Excel: Calculate a specific range

Posted on 2015-02-24
1
47 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

910 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

24 Experts available now in Live!

Get 1:1 Help Now