1
私は1つのセルで単語を使用しようとしている、別のシートに移動し、別のセルでその単語を見つける。難しいのは、2番目のシートにはこの言葉がたくさんあるということです。私は、強調表示された単語が青色になっているセルだけが必要です。Excel VBAハイライト検索
私は以下を試しましたが、ループは青い強調表示された単語の上を通って継続し続けます。私は間違って何をしていますか?
Sub TryingIt()
Dim r As Excel.Range
Dim strName As String
Dim strFirstFound As String
strName = ActiveCell.Text
Sheets("Waiting For").Select
Range("A1").Select
Cells.Find(What:=strName, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set r = ActiveCell
If r.Interior.color = vbBlue Then
r.Offset(1, 0).Select
Else:
Do
Cells.Find(What:=strName, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set r = ActiveCell
Loop While r.Interior.color <> vbBlue
r.Offset(1, 0).Select
End If
End Sub
'r.Interior.color'?セルの色は青で、フォントの色は? –
また、selectの使用を避けることもできます。 [これを参照してください(http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros) –
私は答えを得た:あなたはより多くのことに注意する必要があります色に特有です。私の場合は、vbBlueだけでなく、RGB(0,176,240)でした。 – user6191327