在操作EXCEL時,大家一錠都有一個經驗,在設定某些功能時,
如用分析工具箱時,點選完想要用的分析方法後,
例如圖1.迴歸操作的輸入Y範圍(Y):;
圖1.迴歸操作
點選後就可以在EXCEL工作頁中選擇要使用的資料範圍。
這個對話框,可以透過Application.InputBox這個方法來滿足。
根據MSDN回饋我們的,要掌握回傳值的結果,要設定TYPE這個參數;
筆者設定為8,也就是"儲存格參照,視為 Range 物件"的回傳值。
EX:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton1_Click() | |
A_INPUTBOX = Application.InputBox("", Type:=8) | |
End Sub |
圖2.選取
圖3.
回傳到A_INPUTBOX變數的情況(筆者沒有放資料在儲存格內 xd)
變更參數設定後,也可以同時輸入文字跟數字歐
EX:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton1_Click() | |
A_INPUTBOX = Application.InputBox("", Type:=1+2) | |
End Sub |
沒有留言:
張貼留言