List changes on a New Sheet Private Sub Worksheet_Change

jamilm

Well-known Member
Joined
Jul 21, 2011
Messages
740
Gurus,

I have the following code earlier posted by Jeffery Lopez, this code only works in logging changes user made on cell values.

i am looking for a code or modification of the below code that if user changes the cell background it should log that , if it cannot log the background color name changed, at least if it logs the colorindex number changed it would be okay. i would appreciate any help on this.

<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> varPValue <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)<br><SPAN style="color:#00007F">Dim</SPAN> Errb <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br><br>****<SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">GoTo</SPAN> ErrTrap:<br>****<SPAN style="color:#00007F">If</SPAN> Target.Value <> varPValue <SPAN style="color:#00007F">Then</SPAN><br>******<SPAN style="color:#00007F">With</SPAN> Sheets("log").Cells(65000, 1).End(xlUp)<br>********.Offset(1, 0).Value = Application.UserName<br>********.Offset(1, 1).Value = "changed cell"<br>********.Offset(1, 2).Value = Target.Address<br>********.Offset(1, 3).Value = "from"<br>********.Offset(1, 4).Value = varPValue<br>********.Offset(1, 5).Value = "to"<br>********.Offset(1, 6).Value = Target.Value<br>********.Offset(1, 7).Value = "On"<br>********.Offset(1, 8).Value = Now()<br>******<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>****<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>****<SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br>ErrTrap:<br>**ErrNum = Err<br>**<br>**<SPAN style="color:#00007F">If</SPAN> ErrNum = 13 <SPAN style="color:#00007F">Then</SPAN><br>****<SPAN style="color:#007F00">'*** Multiple cells have been selected, treat them as one merged group*****</SPAN><br>****<SPAN style="color:#00007F">Resume</SPAN> <SPAN style="color:#00007F">Next</SPAN><br>**<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_SelectionChange(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)<br>****varPValue = Target.Value<br>****<br>****<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Upvote 0
If I recall from briefly looking at it (I have no reason whatsoever to use it), he is informing of the changes via message box, so you'd need to adapt that part.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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