Change Cell Color if Changed

frisbeelee

New Member
Joined
Aug 5, 2013
Messages
4
I have an excel database which doesn't need any inputs but users can change things if they want (weight of an item for example) which can impact results.

I just need vba to color the cell if the user changes it. I think perhaps it's too simple because I can't find this direct question anywhere!

This is what I got

Private Sub Worksheet_Change(ByVal Target As Range)
Dim RangetoChange As Range
Set RangetoChange = Range("N5:N1000")

If Not Intersect(Target, RangetoChange) Is Nothing Then

Target.Interior.Color = 65535

End If

End Sub

Currently I get Run-time error '1004': application-defined or object-defined error :(
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I do not see anything inherently wrong with that code.
What steps exactly do you perform that result in this error?
Are you updating a single cell (if so, what cell are you updating with what)?
Or are you inserting or deleting any rows?
 
Upvote 0
I do not see anything inherently wrong with that code.
What steps exactly do you perform that result in this error?
Are you updating a single cell (if so, what cell are you updating with what)?
Or are you inserting or deleting any rows?
You just beat me. The sheet was locked.... my bad! Will delete!
 
Upvote 0
Solution

Forum statistics

Threads
1,214,893
Messages
6,122,121
Members
449,066
Latest member
Andyg666

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