Auto fill cells when specific word is added to main cell

Ronni f

New Member
Joined
Mar 25, 2021
Messages
3
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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Anthony47

Well-known Member
Joined
Mar 29, 2006
Messages
2,147
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
 
Solution

Ronni f

New Member
Joined
Mar 25, 2021
Messages
3
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
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.
 

Ronni f

New Member
Joined
Mar 25, 2021
Messages
3
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
Hi Anthony,
Apologies for the late reply. This works. Thank you so much.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,750
Messages
5,638,138
Members
417,010
Latest member
jnuss03

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
Top