Auto fill cells when specific word is added to main cell

Ronni f

New Member
Joined
Mar 25, 2021
Messages
10
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
Hi, New to this forum so apologies if Q already answered.
I have a spreadsheet that has a column where only 2 status will ever be added. I want the corresponding cells in the row to be auto filled to firstly remove a word and then add a date - see notes in red.
1616677004915.png
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try using this "Change" event macro:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ckArea As String, myC As Range
'
ckArea = "K2:K100"                  '<<< The range you wish to monitor for changes
If Target.Count > 1 Then Exit Sub
If Not Application.Intersect(Target, Range(ckArea)) Is Nothing Then
    If UCase(Target.Value) = "INSPECTED" Then
        Target.Offset(0, 1).ClearContents
        Target.Offset(0, 2).Value = Date
    End If
End If
End Sub
Rightclick the tab with the name of the worksheet, chose View code; this will open your vba window at the right position. Copy the code and paste it into the empty frame on the rigth of the vba window (if the frame already contains any macro then publish its code to check for compatibility). Customize the line marked <<<

Then return to excel and check how it works.

Bye
 
Upvote 0
Solution
Try using this "Change" event macro:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ckArea As String, myC As Range
'
ckArea = "K2:K100"                  '<<< The range you wish to monitor for changes
If Target.Count > 1 Then Exit Sub
If Not Application.Intersect(Target, Range(ckArea)) Is Nothing Then
    If UCase(Target.Value) = "INSPECTED" Then
        Target.Offset(0, 1).ClearContents
        Target.Offset(0, 2).Value = Date
    End If
End If
End Sub
Rightclick the tab with the name of the worksheet, chose View code; this will open your vba window at the right position. Copy the code and paste it into the empty frame on the rigth of the vba window (if the frame already contains any macro then publish its code to check for compatibility). Customize the line marked <<<

Then return to excel and check how it works.

Bye
Hi Anthony,
Apologies for the late reply. This works. Thank you so much.
 
Upvote 0
Hi Anthony,
Apologies for the late reply. This works. Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,214,428
Messages
6,119,420
Members
448,895
Latest member
omarahmed1

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