Time stamp when multiple cells are modified

sergiumirze

New Member
Joined
Apr 10, 2020
Messages
2
Office Version
  1. 2010
Platform
  1. Windows
Hello All,

I have a file for entering products in a warehouse, so when the product entered the WH its making an automatic timestamp ( the code below).
Now I created another column for when the product was removed form warehouse and i need a time stamp in column 7 when in column 6 was selected the specific text "Removed" .

Can u please help me ?


Private Sub Worksheet_Change(ByVal Target As Range)
For Each cell In Target.Cells
If cell.Row > 1 And cell.Column = 1 Then
If cell.Offset(0, 2).Value = "" Then
cell.Offset(0, 2).Value = Now()
End If

End If
Next
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try this:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim cell As Range, rng As Range
  Set rng = Intersect(Target, Range("A2:A" & Rows.Count & ",F2:F" & Rows.Count))
  If Not rng Is Nothing Then
    Application.EnableEvents = False
    For Each cell In rng
      If cell.Column = 1 And cell.Offset(0, 2).Value = "" Then
        cell.Offset(0, 2).Value = Now()
      ElseIf Cells(cell.Row, 1) <> "" And Cells(cell.Row, 6) = "Removed" Then
        Cells(cell.Row, 7) = Now()
      End If
    Next
    Application.EnableEvents = True
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top