Sub find() Dim result As String result = Application.InputBox("请输入你要查找的内容", , , , , , , 2) '行号 Dim i As Integer '列号 Dim j As IntegerFor i = 1 To 10 For j = 1 To 10 If Cells(i, j).Value = result Then Cells(i, j).Select With Selection.Interior .ColorIndex = 24 End With End If Next j Next i
Sub find()
Dim result As String
result = Application.InputBox("请输入你要查找的内容", , , , , , , 2)
'行号
Dim i As Integer
'列号
Dim j As IntegerFor i = 1 To 10
For j = 1 To 10
If Cells(i, j).Value = result Then
Cells(i, j).Select
With Selection.Interior
.ColorIndex = 24
End With
End If
Next j
Next i
End Sub我用inputbox写了一个根据内容查找单元格的sub,你看看是否能满足你的需要
而不是10*10的范围,或是65536*256的范围。