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
- Flutter 如何將程式碼顯示到介面上Flutter
- 在Vue中使用highlight.js高亮顯示程式碼VueJS
- ultraedit高亮顯示pl/sqlSQL
- 如何實現程式碼高亮
- 67,表格中單元格td自適應高度,最大高度後滾動條顯示
- Flutter之根據執行的platform顯示對應風格的widgetFlutterPlatform
- ABAP的語法高亮是如何在瀏覽器裡顯示的瀏覽器
- laravel Es搜尋 檢索高亮顯示Laravel
- hexo程式碼高亮Hexo
- Python 查詢PDF中的指定文字並高亮顯示Python
- [WPF] 可選擇的TextBlock,正則匹配高亮顯示BloC
- 如何標記excel單元格Excel
- PHPstrom 配置 Laravel Log 格式日誌高亮顯示PHPLaravel
- centos7 vim 編輯Dockerfile顯示高亮CentOSDocker
- 如何把SAP CRM WebClient UI上某個欄位高亮加粗顯示WebclientUI
- 如何讓Mac的Dock僅顯示正在執行的應用程式?Mac
- jquery/js透過當前URL對當前欄目連結高亮顯示jQueryJS
- 一段簡單的顯示當前頁面FPS的程式碼
- GTX1080與RTX2080規格對比 GTX1080Ti顯示卡還值得買嗎?
- 測試程式碼高亮
- 程式碼重構與單元測試——繼續將相應的方法進行移動(八)
- 直播app原始碼,根據頁面滾動高亮顯示目錄的側邊欄APP原始碼
- 第 09 篇:讓部落格支援 Markdown 語法和程式碼高亮
- Java 設定Excel條件格式(高亮條件值、應用單元格值/公式/資料條等型別)JavaExcel公式型別
- 修改VS的程式碼高亮顏色
- django-ckeditor 程式碼高亮Django
- 程式碼高亮網站收集網站
- 如果利用 python 對 java 程式碼進行 單元測試?PythonJava
- postgresql高階應用之合併單元格SQL
- 如何編寫優秀的測試程式碼|單元測試
- 分割單元格
- MVC應用程式顯示Flash(swf)影片MVC
- NPD:研究顯示SVoD 使用者對價格更加敏感
- 做元件庫使程式碼高亮的方法元件
- Jquery實現的高亮效果程式碼分享jQuery
- C# 顯示、隱藏視窗對應的工作列C#
- 對CXListCtrl的項ComboBox顯示值改變的響應方法