|
動かなかったので修正。
やりたい事が良く解ってないけど。
With Worksheets("検索") '.UsedRange
With .Columns(6)
Set FoundCell = .Cells.Find(What:=Mynumber, After:=.Cells(.Cells.Count), _
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, _
MatchByte:=False)
End With
If FoundCell Is Nothing Then
Exit Sub
End If
msg = MsgBox("会社コードは「" & FoundCell.Offset(, -2) & "」" & Chr(13) & _
"会社名は「" & FoundCell.Offset(, -1) & " 」でした。", vbOKCancel)
If msg = vbCancel Then
Exit Sub
End If
fs = FoundCell.Row
F列検索後E列会社名 = FoundCell.Offset(, -1).Value
With .Columns(5)
Set FoundCell = .Cells.Find(What:=F列検索後E列会社名, After:=.Cells(fs), _
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, _
MatchByte:=False)
Do Until fs = FoundCell.Row
FoundCell.Interior.ColorIndex = 3
Ct = Ct + 1
Set FoundCell = .FindNext(FoundCell)
Loop
If Ct > 0 Then
.Cells(fs).Interior.ColorIndex = 3
End If
End With
End With
|
|