|
学生是个小白,想问下各位老师怎样将下面这段代码改为一个按钮的代码?请各位老师教教小弟!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Object, fadd$, r&
If Target.Count > 1 Then Exit Sub
If Target.Address <> [E3].Address Then Exit Sub
[A8:F65536].ClearContents
With Sheet3.Range("F1:F" & Sheet3.[A65536].End(xlUp).Row)
Set c = .Find(Target, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
fadd = c.Address
r = 7
Do
r = r + 1
Cells(r, 3).Resize(, 3) = Sheet3.Range("G" & c.Row & ":I" & c.Row).Value
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> fadd
Else
MsgBox [A3] & Target & " is nothing!", vbInformation
End If
End With
End Sub
|
|