返回列表 上一主題 發帖

[發問] Application.inputbox 問題---[已解決]

回復 1# swatt
  1. Sub tt()
  2. Dim mycell As Range
  3. Worksheets("sheet1").Activate
  4. On Error Resume Next
  5. Set mycell = Application.InputBox(prompt:="Select a cell", Type:=8)
  6. If mycell Is Nothing Then Exit Sub
  7. End Sub
複製代碼

TOP

回復 3# swatt
刪掉 Set   ,後   mycell = Application.InputBox(prompt:="Select a cell", Type:=8)  
你1樓的程序中If mycell = False Then Exit Sub   就沒問題

Set 是將 變數 指定為物件 , Application.InputBox(prompt的Type 也必須是8
按下取消鍵=沒有將物件指定給變數 而產生錯誤值

TOP

        靜思自在 : 閒人無樂趣,忙人無是非。
返回列表 上一主題