zoukankan      html  css  js  c++  java
  • Colour unique formulae and constant cells of all sheets of activeworkbook

    A question in http://www.mrexcel.com/board2/viewtopic.php?t=304750

    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?  

    ----------------------------------------------------

    My answer:

    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

  • 相关阅读:
    MySQL数据库之索引
    python面向对象编程
    linux端口占用
    lintcode
    java基础
    lintcode
    linux 常用命令
    Docker & Kubernates
    angular preparation
    java 命令行
  • 原文地址:https://www.cnblogs.com/fengju/p/6336266.html
Copyright © 2011-2022 走看看