Excel-如何將含有對應值得單元格高亮顯示的程式碼摘抄
Sub HighlightSpecificValue()
'PURPOSE: Highlight all cells containing a specified values
'SOURCE: www.TheSpreadsheetGuru.com
Dim fnd As
String, FirstFound As
String
Dim FoundCell As Range, rng
As Range
Dim myRange As Range, LastCell
As Range
'What value do you want to find?
fnd = InputBox("I want to hightlight cells containing...", "Highlight")
'End Macro if Cancel Button is Clicked or no Text is Entered
If fnd = vbNullString
Then Exit Sub
Set myRange = ActiveSheet.UsedRange
Set LastCell = myRange.Cells(myRange.Cells.Count)
Set FoundCell = myRange.Find(what:=fnd, after:=LastCell)
'Test to see if anything was found
If Not FoundCell
Is Nothing
Then
FirstFound = FoundCell.Address
Else
GoTo NothingFound
End If
Set rng = FoundCell
'Loop until cycled through all unique finds
Do Until FoundCell
Is Nothing
'Find next cell with fnd value
Set FoundCell = myRange.FindNext(after:=FoundCell)
'Add found cell to rng range variable
Set rng = Union(rng, FoundCell)
'Test to see if cycled through to first found cell
If FoundCell.Address = FirstFound
Then Exit Do
Loop
'Highlight Found cells yellow
rng.Interior.Color = RGB(255, 255, 0)
'Report Out Message
MsgBox rng.Cells.Count & " cell(s) were found containing: " & fnd
Exit Sub
'Error Handler
NothingFound:
MsgBox "No cells containing: " & fnd & " were found in this worksheet"
End Sub
相關文章
- excel怎麼高亮顯示區域中活動單元格所在的行和列Excel
- pycharm程式碼不高亮顯示怎麼辦PyCharm
- Excel-單元格內換行Excel
- Flutter 如何將程式碼顯示到介面上Flutter
- vba-單元格程式碼
- 將搜尋關鍵詞高亮顯示例項程式碼
- js實現關鍵詞高亮顯示程式碼例項JS
- Jupyter 操作程式碼單元格
- ultraedit高亮顯示pl/sqlSQL
- 67,表格中單元格td自適應高度,最大高度後滾動條顯示
- Excel2010如何快速將文字框與單元格對齊?Excel
- 將圖片以灰色方式顯示的程式碼
- 在Vue中使用highlight.js高亮顯示程式碼VueJS
- 表格左上角單元格對角線效果例項程式碼
- 如何實現程式碼高亮
- 將搜尋關鍵字設定為高亮顯示例項程式碼
- 部落格園使用sublime text風格的程式碼高亮樣式
- TextView搜尋文字高亮顯示TextView
- td單元格合併程式碼例項
- 讓你掘金部落格中的程式碼顯示得更酷
- Swift - 非同步載入各網站的favicon圖示,並在單元格中顯示Swift非同步網站
- ABAP的語法高亮是如何在瀏覽器裡顯示的瀏覽器
- SAP Fiori應用Footerbar區域按鈕的高亮顯示邏輯
- Flutter之根據執行的platform顯示對應風格的widgetFlutterPlatform
- table表格單元格合併程式碼例項
- 如何隱藏Excel中單元格公式且其他單元格可修改Excel公式
- 常見機箱LCD螢幕顯示程式碼對應資訊詳解
- laravel Es搜尋 檢索高亮顯示Laravel
- Lucene多欄位查詢&高亮顯示
- Excel——如何使用VBA操作單元格的格式Excel
- linux下使用ccat讓你的cat高亮顯示Linux
- [WPF] 可選擇的TextBlock,正則匹配高亮顯示BloC
- 如何把SAP CRM WebClient UI上某個欄位高亮加粗顯示WebclientUI
- centos7 vim 編輯Dockerfile顯示高亮CentOSDocker
- Mac 終端命令列顏色高亮顯示Mac命令列
- CUDA開發環境高亮顯示設定開發環境
- hexo程式碼高亮Hexo
- 如何在 Bash Shell 指令碼中顯示對話方塊指令碼