Public actRng
Private Sub CommandButton1_Click()
actRng.Value = "▲"
'actRng.Offset(0, 1).Select
'ThisWorkbook.ActiveSheet.Activate ' 將控制權轉移到目前工作表
unload me
'或者可以試試看UserForm1. Hide
End Sub
Private Sub UserForm_Activate()
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeName(ctrl) = "CommandButton" Then
ctrl.TabStop = False
End If
Next ctrl
End Sub
Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
Application.SendKeys "{TAB}"
KeyCode = 0
End If
End Sub
複製代碼
Sub showUF1()
set actRng = ActiveCell
UserForm1.Show 0 'modeless
End Sub