Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a list of about 55,000 entries in Column A. Though sorted by value,
the values change at various/random times. I need to determine, in a macro, when the value changes so that I can take action to do something else. So, how can I say: If ActiveCell.Value < (the value of the cell directly above it) Then takeaction In other words, I don't know how to refer to the cell directly above the current cell. It can't be the exact address because there are thousands of different address. Maybe it has something to do with ActiveCell.Offset(-1, 0) but I don't think that's quite it. Thanks. Dan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ActiveCell.Offset(-1, 0).Value - is correct to get the value above the
active cell. Try it. If ActiveCell.value < ActiveCell.Offset(-1,0).Value then 'take action End If you might want to put this in the worksheet change event to detect changes in column A something like.... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then If ActiveCell.Value < ActiveCell.Offset(-1, 0).Value Then MsgBox "Do something" End If End If End Sub -- Cheers Nigel "crimsonkng" wrote in message ... I have a list of about 55,000 entries in Column A. Though sorted by value, the values change at various/random times. I need to determine, in a macro, when the value changes so that I can take action to do something else. So, how can I say: If ActiveCell.Value < (the value of the cell directly above it) Then takeaction In other words, I don't know how to refer to the cell directly above the current cell. It can't be the exact address because there are thousands of different address. Maybe it has something to do with ActiveCell.Offset(-1, 0) but I don't think that's quite it. Thanks. Dan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, guys.
I tried Nigel's and it worked, for the most part (my data was a little wierd). I like to learn things so I'll try Norman's suggestion later. Thanks for taking the time to reply and solving this. Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare value in current cell to previous cell | Excel Worksheet Functions | |||
Repeat: Active Cell's Address | Excel Programming | |||
Remember a previous cell's value | Excel Worksheet Functions | |||
Previous active cell | Excel Programming | |||
Get a cell's previous value | Excel Programming |