Vba to highlight which cell has what input

i am looking for a vba solution that does the following

a simple macro that puts cell background color based on cell inputs for all worksheets in activeworkbook

if cell input is formula but not array formula then green background
if cell input is array formula then light green
if cell input is date without time then yellow background
if cell input is dates with time then orange
if cell input is Boolean then silver
if cell input is number then Peach
if cell input is text then Raspberry color
if cell input is error then Violet
if cell input is space or char 16 or char 10 any invisible char then Azure

also a undo line that will reset the background color back to NoFILL

thanks.
LVL 6
FloraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

 Sub macroFillDataType()

For Each sh In ActiveWorkbook.Worksheets
    For Each c In sh.UsedRange
        If c.HasFormula And c.HasArray = False Then
            c.Interior.Color = RGB(0, 255, 0)
        ElseIf c.HasFormula Then 'c.HasArray = True
            c.Interior.Color = RGB(144, 238, 144)
        ElseIf c = "" Then 'from here c.HasFormula = False
           '
        ElseIf WorksheetFunction.Trim(WorksheetFunction.Clean(c)) = "" Then
            c.Interior.Color = RGB(240, 255, 255)
        ElseIf WorksheetFunction.IsText(c) Then
            c.Interior.Color = RGB(227, 11, 93)
        ElseIf IsDate(c.Text) And InStr(1, c.NumberFormat, "h:m") = 0 Then
            c.Interior.Color = RGB(255, 255, 0)
        ElseIf IsDate(c.Text) Then 'InStr(1, c.NumberFormat, "h:m") > 0
            c.Interior.Color = RGB(255, 165, 0)
        ElseIf WorksheetFunction.IsLogical(c) Then
            c.Interior.Color = RGB(192, 192, 192)
        ElseIf WorksheetFunction.IsNumber(c) Then
            c.Interior.Color = RGB(255, 218, 185)
        ElseIf IsError(c) Then
            c.Interior.Color = RGB(238, 130, 238)
        Else
            ''
        End If
    Next
Next
End Sub
Sub MacroNoFill()

For Each sh In ActiveWorkbook.Worksheets
    sh.UsedRange.Interior.ColorIndex = xlNone
Next
End Sub 

Open in new window

Regards
FillDataType.xlsm

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FloraAuthor Commented:
many thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.