Excel-如何将含有对应值得单元格高亮显示的代码摘抄
来源:互联网 发布:台湾淘宝花种子 编辑:程序博客网 时间:2024/06/05 05:14
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, rngAs Range
Dim myRange As Range, LastCellAs 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 FoundCellIs Nothing Then
FirstFound = FoundCell.Address
Else
GoTo NothingFound
End If
Set rng = FoundCell
'Loop until cycled through all unique finds
Do Until FoundCellIs 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-如何将含有对应值得单元格高亮显示的代码摘抄
- ABAP--如何将月份转化为对应文本(代码摘抄)
- ABAP--如何将月份转化为对应文本(代码摘抄)
- 将含有合并单元格的Excel文档导入到SQL Server表中
- excel 将A列相同的值对应的B列的单元格进行合并,并保留单元格内容
- 如何将特定文件类型高亮显示
- 如何将拷贝过来的代码实现高亮
- EXCEL中,怎么输入一个代号,显示对应的内容,输入和显示都在同一单元格
- 如何让页面里面的java代码高亮显示
- 教你如何将txt复制到excel的各个单元格;并解决科学计数法显示问题及导致的个位数变0问题
- [My Own Wheels]含有合并单元格的html读取代码
- 如何将excel单元格的默认格式设置为常规格式
- 解析json数据将数据填入表格对应的单元格
- vba操作excel的合并单元格代码
- excel中点击单元格时如何不让编辑栏里显示单元格里的内容
- 如何将Excel里的数据显示到界面上
- 如何将Excel中隐藏的列显示出来
- 将java代码生成html并且高亮显示
- jquery插件之DataTables
- <Python基础教程>学习心得_第二章
- 为mini2440的Qt程序增加字体并使字体大小可改变
- scheduledTimerWithTimeInterval
- linux上安装配置vsftpd
- Excel-如何将含有对应值得单元格高亮显示的代码摘抄
- Node.JS学习——使用cookie 和 session
- 接下来一段时间的计划
- 产生fibonacci数列的第i个数字(递归实现,非递归实现)
- python批量图片切割(opencv版)
- poj 3294 后缀数组
- 文件夹备份软件
- linux truncate 文件
- mysql replace的使用弊端