人气 4108

Excel VBA查找变色 [复制链接]

wangjs 2017-4-28 17:40:44
从C1:D10中查找同行第m列中的字符(n为连续字符数),把相同字符变成红色Sub CGC()  Dim i As Long  Dim tmpRange As Range  Dim strS As String  For Each tmpRange In Range([c1], [d10])    strS = tmpRange.Text    For i = 1 To Len(strS)      If Cells(tmpRange.Row, m).Text Like "*" & Mid$(strS, i, n) & "*" Then        With tmpRange.Characters(Start:=i, Length:=1).Font          .ColorIndex = 3        End With      End If    Next  NextEnd Sub
您需要登录后才可以回帖 登录 | 立即注册

QQ|手机版|精益人 ( 沪ICP备19004111号-1 )|网站地图

GMT+8, 2024-12-22 23:13 , Processed in 0.240611 second(s), 20 queries .

Powered by Lean.ren X3.5 Licensed  © 2001-2030 LEAN.REN