一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

excel (too-many-different-cell-formats)

 Stock好資料 2017-06-06
https:///questions/2449755/too-many-different-cell-formats
Check How many Formats
Public Sub GetFormats()

    Dim CurrentSheet As Integer
    Dim UsedRange As Range
    Dim CurrentCell As Range
    Dim rw As Long

    Sheets("Formats").Cells.ClearContents
    rw = 1
    For CurrentSheet = 1 To Sheets.Count
        Set UsedRange = Range(Sheets(CurrentSheet).Range("A1"), Sheets(CurrentSheet).Range("A1").SpecialCells(xlLastCell))
        For Each CurrentCell In UsedRange
            FontUsed = CurrentCell.Font.Name + ":" + CStr(CurrentCell.Font.Size)
            If Sheets("Formats").Cells.Find(FontUsed) Is Nothing Then
                Sheets("Formats").Cells(rw, 1).Value = FontUsed
                rw = rw + 1
            End If
        Next
    Next CurrentSheet
End Sub 
            
Clear too many different cell formats
' Description:
'    Borrowed largely from http://www./Articles/styles06.asp

Option Explicit

' Description:
'    This is the "driver" for the entire module.
Public Sub DropUnusedStyles()

    Dim styleObj As Style
    Dim rngCell As Range
    Dim wb As Workbook
    Dim wsh As Worksheet
    Dim str As String
    Dim iStyleCount As Long
    Dim dict As New Scripting.Dictionary    ' <- from Tools / References... / "Microsoft Scripting Runtime"

    ' wb := workbook of interest.  Choose one of the following
    ' Set wb = ThisWorkbook ' choose this module's workbook
    Set wb = ActiveWorkbook ' the active workbook in excel


    Debug.Print "BEGINNING # of styles in workbook: " & wb.Styles.Count
    MsgBox "BEGINNING # of styles in workbook: " & wb.Styles.Count

    ' dict := list of styles
    For Each styleObj In wb.Styles
        str = styleObj.NameLocal
        iStyleCount = iStyleCount + 1
        Call dict.Add(str, 0)    ' First time:  adds keys
    Next styleObj
    Debug.Print "  dictionary now has " & dict.Count & " entries."
    ' Status, dictionary has styles (key) which are known to workbook


    ' Traverse each visible worksheet and increment count each style occurrence
    For Each wsh In wb.Worksheets
        If wsh.Visible Then
            For Each rngCell In wsh.UsedRange.Cells
                str = rngCell.Style
                dict.Item(str) = dict.Item(str) + 1     ' This time:  counts occurrences
            Next rngCell
        End If
    Next wsh
    ' Status, dictionary styles (key) has cell occurrence count (item)


    ' Try to delete unused styles
    Dim aKey As Variant
    On Error Resume Next    ' wb.Styles(aKey).Delete may throw error

    For Each aKey In dict.Keys

        ' display count & stylename
        '    e.g. "24   Normal"
        Debug.Print dict.Item(aKey) & vbTab & aKey

        If dict.Item(aKey) = 0 Then
            ' Occurrence count (Item) indicates this style is not used
            Call wb.Styles(aKey).Delete
            If Err.Number <> 0 Then
                Debug.Print vbTab & "^-- failed to delete"
                Err.Clear
            End If
            Call dict.Remove(aKey)
        End If

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多

    中文字幕精品一区二区三| 欧美激情中文字幕综合八区| 真实国产乱子伦对白视频不卡 | 国产又粗又猛又爽又黄的文字| 亚洲一区二区精品免费| 欧美精品二区中文乱码字幕高清| 欧美国产日本免费不卡| 好吊视频有精品永久免费| 日韩午夜福利高清在线观看| 色综合久久六月婷婷中文字幕| 欧美日韩精品久久第一页| 欧美一区二区三区视频区| 成人三级视频在线观看不卡| 欧美胖熟妇一区二区三区| 欧美日韩三区在线观看| 熟妇久久人妻中文字幕| 中日韩免费一区二区三区| 亚洲日本中文字幕视频在线观看| 丝袜av一区二区三区四区五区| 日韩免费午夜福利视频| 欧美成人高清在线播放| 国产av天堂一区二区三区粉嫩| 国产精品自拍杆香蕉视频| 99久久人妻精品免费一区| 成人精品一级特黄大片| 熟女少妇一区二区三区蜜桃| 日韩成人动画在线观看| 最近的中文字幕一区二区| 欧美不卡午夜中文字幕| 亚洲视频偷拍福利来袭| 福利新区一区二区人口| 开心激情网 激情五月天| 日韩成人高清免费在线| 正在播放国产又粗又长| 91欧美日韩一区人妻少妇| 国产成人综合亚洲欧美日韩| 欧美日韩中黄片免费看| 久久精品蜜桃一区二区av| 欧美一区二区三区性视频| 欧美一级不卡视频在线观看| 中国一区二区三区不卡|