给你个例子,可以参考下,在表上建立一个 CommandButton1 和 Label1
代码:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If X > 0 And X < CommandButton1.Width And _
Y > 0 And Y < CommandButton1.Height Then
hint = "This's Button1"
With Label1
.Caption = hint
.Left = X + CommandButton1.Left
.Top = Y + CommandButton1.Top
.Visible = True
End With
End If
End Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Label1.Visible = False
End Sub
追问谢谢,已经可以了,但是如果同时点击CommandButton1时,希望可以起到复制某一行的功能,该怎么设置?貌似没看到指定宏
追答rr=Target.Row()
Rows(rr).Copy
‘即可复制一行
Cells(1,1).Paste
’ 可粘贴到第一行
Application.CutCopyMode = False
‘清除拷贝时产生的虚线框