Solved

Excel: Calculate a specific range

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

Technology Partners: 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

Suggested Solutions

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 descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

756 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