Return the fill color after save

noelmus

Board Regular
Joined
Dec 30, 2018
Messages
105
Hi,
I have this code (below) that remove the fill color after update those 5 cells. I need that when I save the worksheet, those 5 cells return with the fill color. Is this possible?

Code:

Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("J9,J12,C14,E28,E29")) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = "" Then
Target.Interior.ColorIndex = 6
Else
Target.Interior.ColorIndex = xlNone
End If
End If
End Sub

Thanks in advance
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
1. Place in ThisWorkbook module (NOT standard or worksheet module)
2. Amend sheetname
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Sheets("[COLOR=#ff0000][I]SheetName[/I][/COLOR]").Range("J9,J12,C14,E28,E29").Interior.ColorIndex = 6
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

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