Try something like
Sub CHECK()
Dim FIRST As Range, SECOND As Range, THIRD As Range
On Error Resume Next
Set FIRST = Application.InputBox(prompt:="First", Type:=8)
If FIRST Is Nothing Then
MsgBox "First was not set."
Else
MsgBox "First: " & FIRST.Address
End If
Set SECOND = Application.InputBox(prompt:="Second", Type:=8)
If SECOND Is Nothing Then
MsgBox "Second was not set."
Else
MsgBox "Second: " & SECOND.Address
End If
Set THIRD = Application.InputBox(prompt:="Third", Type:=8)
If THIRD Is Nothing Then
MsgBox "Third was not set."
Else
MsgBox "Third: " & THIRD.Address
End If
End Sub
You'll find that code is easier to read and write if you use named
arguments rather than positional arguments. E.g., instead of
Set FIRST = Application.InputBox("First", , , , , , , 8)
use
Set FIRST = Application.InputBox(prompt:="First", Type:=8)
With positional notation, it is too easy to get the wrong number of
commas, even with intellisense support.
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sat, 12 Sep 2009 14:07:01 -0700, Faraz A. Qureshi
wrote:
Nice 2 hear from u after quite a longtime Chip!
However, the resulting messages even dont appear after debug statement.
Could u please redevise the macro I have presented?