Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update column based on update of another column 1

Status
Not open for further replies.
Oct 23, 2002
110
US
I have a spreadsheet with 12 tabs, each tab has a differnet amount of rows. I need a macro that will update a cell every time another cell is changed. The issue I have is I want this performed on 2 columns of data in each worksheet.

Example:
B2 is updated so O2 shows date of update
B100 is updated so O100 shows date of update
B6928 is updated 20 O6928 shows date of update

Everytime a cell in column B is update, I need to corresponding cell in column O (same row) updated with the current date.

I have the following code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Column = "B$2$" Then
        Target.Row
        Range("O2") = Now()
        Range("O2").NumberFormat = "dd-mmm-yyyy"
    End If

End Sub
However, with this code I would need to repeat it for B2 until the end of the data for each sheet. Is there an easier way??
 
Perhaps this ?
If Target.Column = 2 Then
Target.Offset(0, 13) = Now
Target.Offset(0, 13).NumberFormat = "dd-mmm-yyyy"
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top