Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Range Selection Color WCMOUSER Excel Discussion (Misc queries) 1 October 18th 08 04:51 PM
Individual cell selection in a range Riddler Excel Discussion (Misc queries) 3 December 8th 06 10:26 PM
First row in Selection range (first index of a cell) EXCEL VBA [email protected] Excel Worksheet Functions 1 March 20th 06 09:38 PM
HELP - Date Range In 1 Cell Calculation Adam Excel Worksheet Functions 6 September 19th 05 08:24 PM
CELL RANGE SELECTION ON EXISTING PIVOT TABLE MitchP Excel Worksheet Functions 3 August 8th 05 08:45 PM


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"