Cell Update kickoffs Another Cell Update

V L

New Member
Joined
Jul 25, 2024
Messages
14
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello All:

Looking for some assistance with the following. The contents of cell C17 occasionally gets updated. When this occurs, I would like cell S4 to automatically update to todays date. This workbook contains many tabs. This will only need to run on select sheets. Thank you in advance...
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Put code like this in the "ThisWorkbook" module in the VB Editor (it absolutely MUST be in this location), and edit the IF statement to match what sheets you want to run it against:
VBA Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

'   Exit if multiple cells updated at once
    If Target.CountLarge > 1 Then Exit Sub

'   Only run on Sheets 2 and 3
    If (Sh.Name = "Sheet2") Or (Sh.Name = "Sheet3") Then
'       See if cell C17 is updated
        If Target.Address(0, 0) = "C17" Then
'           Update cell S4 with today's date
            Sh.Range("S4") = Date
        End If
    End If
    
End Sub
 
Upvote 0
Put code like this in the "ThisWorkbook" module in the VB Editor (it absolutely MUST be in this location), and edit the IF statement to match what sheets you want to run it against:
VBA Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

'   Exit if multiple cells updated at once
    If Target.CountLarge > 1 Then Exit Sub

'   Only run on Sheets 2 and 3
    If (Sh.Name = "Sheet2") Or (Sh.Name = "Sheet3") Then
'       See if cell C17 is updated
        If Target.Address(0, 0) = "C17" Then
'           Update cell S4 with today's date
            Sh.Range("S4") = Date
        End If
    End If
   
End Sub
Would it be possible to add some VBA to the individual sheets that will need to run this?
 
Upvote 0
Note you should always disable events if you are changing cells on the same sheet whose Change event you are monitoring.
 
Upvote 0
Would it be possible to add some VBA to the individual sheets that will need to run this?
Please explain exactly what you are talking about in more detail.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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