0
' On Error Resume Next 'Turn off error handling
Set mf = Selection.Find(What:=FindText, after:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False) 'search and find my opnumber
On Error GoTo 0 'turn back on default error handeling
If mf Is Nothing Then
MyActiveSheet.Activate
With mf
.Interior.ColorIndex = 27
End With
GoTo skipit
Else
mf.Activate
End If
내 검색에서 찾지 못한 모든 셀을 노란색으로 강조 표시하려고합니다. 어떤 이유로 나는 그것을 작동시키지 않는 것 같습니다. 다음VBA : 내 검색으로 찾지 못한 셀을 강조 표시합니다.
Sub test()
Dim mf As Range
Dim sAddr As String
Dim FindText As String
FindText = "test"
With Selection
.Interior.ColorIndex = 27
Set mf = .Find(What:=FindText, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not mf Is Nothing Then
sAddr = mf.Address
Do
mf.Interior.ColorIndex = xlNone
Set mf = .FindNext(mf)
If mf Is Nothing Then Exit Do
Loop While mf.Address <> sAddr
End If
End With
End Sub
주요 아이디어는 노란색으로 전체 선택을 강조하고, :
'모든 셀을 강조 표시하려고합니다.'- 전체 셀의 모든 셀 또는 현재 선택의 모든 셀? –
'If mf Is Nothing Then'은'Not mf Is Nothing Then'이어야합니다. –
은 검색에서 찾지 못한 것을 강조 표시합니다. – tharoush