Excel // VBA / / Macro // Code needed to set a date in a cell in the contents of another cell changes

Evremonde

New Member
Joined
Sep 29, 2016
Messages
23
Hello All:

I have a spreadsheet and I need some VBA assistance. I think this is easy but we shall see. Cells E2 through E1000 may contain either OP or GS. On initial data entry, the contents of the range will be set to either OP or GS (data entry will start at E2 and proceed to E3, E4, Etc as need). After initial data entry, the contents of the range may be changed from OP to GS - or - from GS to OP. If this occurs, I need to set the date of change in another column on the same row (not sure which column yet). Any VBA code to perform this function would be appreciated.
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
3,990
Office Version
365
Platform
Windows
Try something like this
1. Right click on the worksheet tab(the worksheet with the data
2. Select "View Code"
3. Paste the following code in there

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("E2:E1000")) Is Nothing Then
        Range("Z" & Target.Row).Value = Time
    End If
End Sub
It updates the date in column Z
 

Watch MrExcel Video

Forum statistics

Threads
1,099,325
Messages
5,467,949
Members
406,560
Latest member
dwinsburg

This Week's Hot Topics

Top