Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell range selection after calculation
Dim oldrng as Range
Dim newrng as Range Private Sub Worksheet_SelectionChange(ByVal Target As Range) if not newrng is nothing then Set oldrng = newrng set newrng = Target End Sub Private Sub Worksheet_Calculate() Dim ModifiedCellRange as Range set ModifiedCellRange = newrng msgbox modifiedcellrange.Address End Sub Calculate fires before SelectionChange, so the most likely trigger for the calculate is newrng -- Regards, Tom Ogilvy "Edward" wrote in message ... I need to determine the cell range/address of the last cell that a calculation was driven off. Essentially, I want to compare that value with known quantities in other worksheets that I can already isolate. The problem is that the code below selects the cell after one has pressed <ENTER key or used the cursor. As such, I can't use an offset because of the multiple ways to enter data. Basically, I need to select the cell before the value has been changed if you will...or find a way to select that cell afterwards. Thanks. I have been using the following code: Private Sub Worksheet_Calculate() Dim ModifiedCellRange as Range ModifiedCellRange = Selection.Address End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell Range Selection Color | Excel Discussion (Misc queries) | |||
Individual cell selection in a range | Excel Discussion (Misc queries) | |||
First row in Selection range (first index of a cell) EXCEL VBA | Excel Worksheet Functions | |||
HELP - Date Range In 1 Cell Calculation | Excel Worksheet Functions | |||
CELL RANGE SELECTION ON EXISTING PIVOT TABLE | Excel Worksheet Functions |