我有以下代碼,提示用戶選擇一個範圍的單元格。檢查用戶選擇的範圍或取消
我很難檢查範圍是否有效(即他們是否只是在輸入框中輸入數字?),或者他們是否按下取消。我如何區分?
Do While (True)
Dim mInput As Range
mInput = Application.InputBox(Prompt:="Please select the cells.", Type:=8)
If (mInput Is Nothing) Then
Exit Sub
End If
If (mInputRange.Columns.Count <> 1) Then
MsgBox "There must be only one column selected.", vbOKOnly
Else
End If
Loop
僅供參考'做雖然(真)'與「Do While True」與「簡單」Do「相同,它更簡潔易讀。 – 2012-03-21 07:55:12