网站首页 > 技术文章 正文
Private Sub Worksheet_SelectionChange(ByVal T As Range)
Dim Rg As Range, SumRg As Range
If T.Value = "" Then Exit Sub
Set Rg = Range("A1").CurrentRegion.Find(T, Lookat:=xlWhole)
MyAddress = Rg.Address
Do
Set Rg = Range("A1").CurrentRegion.FindNext(Rg)
k = k + 1
If k = 1 Then
Set SumRg = Rg
Else
Set SumRg = Application.Union(SumRg, Rg)
End If
Loop While Rg.Address <> MyAddress
Application.EnableEvents = False
SumRg.Select
Range("A1").CurrentRegion.Interior.ColorIndex = xlNone
SumRg.Interior.ColorIndex = 6
Application.EnableEvents = True
End Sub
猜你喜欢
- 2024-10-01 Excel VBA 事件过程实现数据变化结果也会随之自动更新
- 2024-10-01 每天长时间盯着电脑,这三招帮你缓解眼睛疲劳
- 2024-10-01 Excel-VBA:13、Excel事件程序(vba事件怎么触发)
- 2024-10-01 excel vba常用语句干货分享,错过了就不会再有了(关注!)
- 2024-10-01 设计模式之观察者模式,事件机制的底层原理全面解析(建议收藏)
- 2024-10-01 Excel实用技巧:根据条件,锁定某个单元格
- 2024-10-01 苹果电脑这些超实用的隐藏功能,不会用就等于白花钱了!
- 2024-10-01 办公小技巧:制作自动显示子菜单的下拉菜单
- 2024-10-01 常用的、带解释的 VBA 短句(vba常用语句详解)
- 2024-10-01 「第2辑」Excel VBA知识分享——进度条
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)