-1
열린 여러 통합 문서에서 문자열을 찾고 행을 색칠하는 방법. 문자열은 모든 시트에서 중복 될 수 있으며 A 열, B 열 또는 C 열에 나타날 수 있습니다.이 코드를 더 많은 통합 문서에 적용 할 수 있습니까? 나는 하나의 통합 문서에이 코드를 발견열린 여러 통합 문서에서 문자열 찾기
Sub Search_String()
Dim SearchString As String
Dim SearchRange As Range, cl As Range
Dim Escolhe_Cor As Long
Dim FirstFound As String
Dim sh As Worksheet
' Set Search value
SearchString = InputBox("Digite o número a ser procurado")
Escolhe_Cor = InputBox("Escolha uma cor para destacar esse número. De 3 a 56")
Application.FindFormat.Clear
' loop through all sheets
For Each sh In ActiveWorkbook.Worksheets
' Find first instance on sheet
Set cl = sh.Cells.Find(What:=SearchString, _
After:=sh.Cells(1, 1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not cl Is Nothing Then
' if found, remember location
FirstFound = cl.Address
' format found cell
Do
cl.EntireRow.Font.Bold = True
cl.EntireRow.Interior.ColorIndex = Escolhe_Cor
' find next instance
Set cl = sh.Cells.FindNext(After:=cl)
' repeat until back where we started
Loop Until FirstFound = cl.Address
End If
Next
End Sub
질문을 계속하십시오 ... –
안녕하세요,이 코드를 더 많은 통합 문서에 적용 할 수 있습니까? –