- 帖子
- 354
- 主題
- 5
- 精華
- 0
- 積分
- 387
- 點名
- 0
- 作業系統
- windows7
- 軟體版本
- vba,vb,excel2007
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2017-1-8
- 最後登錄
- 2024-8-2
 
|
本帖最後由 singo1232001 於 2023-7-24 02:19 編輯
回復 2# reangame
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 |
|