macro to check if any cells in a column have turned red due to conditional formating

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I have a big problem with duplicates and I'm trying to get it sorted out.
however I'd like a warning message box to tell me when one has been identified.

currently I use conditional formatting to turn the cell red if its a duplicate.
but I don't go to the tab very often and it hold a lot of data so I was hoping I could get a macro that would warn me if duplicates are there.

So here's what I would like.

A macro that when I run it looks at sheet "Capacity" column "AM" and check to see if any cells have been conditionally turn red (I say conditionally as this is different to filling it red manual)
if it finds any red cells a message box pops up saying "Possible Duplicates in capacity sheet!"

please help if you can

Thanks

Tony
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
If you have 2010 or later:

Code:
dim rg as range, cell as range
with Sheets("Capacity")
   set rg = .range("AM2", .cells(.rows.count, "AM").end(xlup))
end with
for each cell in rg.cells
   if cell.displayformat.interior.color = vbred and cell.interior.color <> vbred then
      msgbox "there are duplicates
      exit for
   end if
next cell
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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