給各位作分享了,小弟也是從論壇上找資料自已編譯的。
Sub Find()
Dim FindString As Integer
Dim FirstAddress As String
FindString = InputBox("請輸入數值")
Dim oRng As Range
Set oRng = Range("E1:I3000").Find(what:=FindString, LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlRows, matchbyte:=True)
If Not oRng Is Nothing Then
FirstAddress = oRng.Address
Do
Debug.Print oRng.Row, oRng.Address, oRng.Value
Set oRng = Range("E1:I3000").FindNext(oRng)
oRng.Interior.ColorIndex = 4
oRng.Offset(0, 7).Interior.ColorIndex = 4
Loop While Not oRng Is Nothing And oRng.Address <> FirstAddress
End If
End Sub作者: pegawang 時間: 2016-8-21 20:32