BirdWatchers
asked on
Flag column if changed
I am interested in simply flagging the column using VBA if anything (in that column alone) has changed.
ASKER
I am just going to put a 1 in row 16 of that column I have an if statement that will trigger logic if the column has changed, but I don't know how to flag if the column has changed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There could be anywhere from 50 to 4,000 rows of data - I just need to now if just one piece has changed in the one column .. that is it.
Mine works on column C but that's easily changed.
Something like this may be what you are looking for...
Please see the attached workbook.
PS. It could be improved by only processing one cell from each column in the Target range, but typically the Worksheet_Change(...) event will only ever process one cell at a time anyway, so that approach may well be just for very extreme cases.
The code above copes with changing multiple cells at once, though.
Q-28702863.xlsm
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim objCell As Range
On Error Resume Next
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each objCell In Target
DoEvents
If objCell.Row <> 16& Then
Me.Cells(16&, objCell.Column).Value = 1
End If ' If objCell.Row <> 16& Then
Next objCell ' For Each objCell In Target
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Please see the attached workbook.
PS. It could be improved by only processing one cell from each column in the Target range, but typically the Worksheet_Change(...) event will only ever process one cell at a time anyway, so that approach may well be just for very extreme cases.
The code above copes with changing multiple cells at once, though.
Q-28702863.xlsm
Simply this where 3 represents column C..
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns(3)) Is Nothing Then
Cells(16, 3) = 1
End If
End Sub
I'm glad I was able to help. If you actually chose one of my solutions that used 'ActiveCell', you should substitute 'Target'.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
You're welcome, BirdWatchers.
(Sigh)
(Sigh)
Internally within Visual Basic for Applications code for later interrogation, visually in-cell somewhere within the same column, or elsewhere (such as a different worksheet, or in an external file, for example)?