Colour unique formulae and constant cells

neodjandre

Well-known Member
Joined
Nov 29, 2006
Messages
950
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I am looking for a macro which does two things:

1. colours all constants in a workbook as yellow.

2. colours all formulae with purple but I don't want the formulae which are copies to be coloured (i.e. the ones which are copied across columns or copied down in rows).

is there any way of doing this?

thanks very much
andy
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I use UltraSleuth Gold:

http://www.dslimited.biz/

you can get a free version for a 30 day trial. ( then it costs $75 to buy .... I bought it last year ). This is not an advert, I am a user ... it would have taken me weeks to write all the functionality that's in this add-in.
 
Upvote 0
thanks Glenn. I am sure this is a useful tool however I need to have some vba code for this. The reason for that (believe it or not) is that I am not allowed to use any add ins, third party software on the machine I will be working on !

I am thinking of purchasing this anyway .. seems to be very useful !
 
Upvote 0
Code:
Sub macro1()
Dim sh As Worksheet
For Each sh In Sheets
sh.Cells.SpecialCells(xlCellTypeConstants, 23).Interior.Color = vbYellow
Next
End Sub

Best Regards
Northwolves
 
Upvote 0
Code:
Sub Addbackcolor()
Dim sh As Worksheet, d As Object, r As Range
Set d = CreateObject("scripting.dictionary")
For Each sh In Sheets
d.RemoveAll
For Each r In sh.Cells.SpecialCells(xlCellTypeFormulas, 23)
If Not d.exists(r.FormulaR1C1) Then d.Add r.FormulaR1C1, r.Address
Next
sh.Range(Join(d.items, ",")).Interior.Color = &HFF99CC
sh.Cells.SpecialCells(xlCellTypeConstants, 23).Interior.Color = vbYellow
Next
Set d = Nothing
End Sub

Best Regards
Northwolves
 
Upvote 0
thanks Glenn. I am sure this is a useful tool however I need to have some vba code for this. The reason for that (believe it or not) is that I am not allowed to use any add ins, third party software on the machine I will be working on !

I am thinking of purchasing this anyway .. seems to be very useful !

I can believe that you're not allowed any add-ins, or third-party software ... I worked at a place that had the same rules too. ( no add-ins at all, not even Excel ones, nor any API code usage ).

Anyway, I hope that Northwolves code is a good starting point for you.
 
Upvote 0

Forum statistics

Threads
1,223,993
Messages
6,175,846
Members
452,675
Latest member
duongtruc1610

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