Cyberdude
08-30-2005, 12:05 PM
I thought I read somewhere that when using Application.InputBox as a prompt to get a cell address that the user could just click on the cell on the worksheet and the address would magically appear in the input area. I've been trying to do that, and it works! Except that the value isn't passed to the variable it's assigned to. Consider the following:
Sub Test()
Dim Msg As String, StartAddr As Variant
Msg = "Enter the address of the upper left" & vbCr & _
" corner of the array:"
StartAddr=Application.InputBox(Msg,Type:=6) '(2=Text + 4=Logical)
If StartAddr = False Or StartAddr = vbNullString Then GoTo Finish
'(other logic here)
Finish:
End Sub
When I try clicking the worksheet, the address appears in the input area, but the variable StartAddr gets a null string, as if nothing was filled in on the input area. If I type the address into the input area, it works correctly. What am I missing?
Sub Test()
Dim Msg As String, StartAddr As Variant
Msg = "Enter the address of the upper left" & vbCr & _
" corner of the array:"
StartAddr=Application.InputBox(Msg,Type:=6) '(2=Text + 4=Logical)
If StartAddr = False Or StartAddr = vbNullString Then GoTo Finish
'(other logic here)
Finish:
End Sub
When I try clicking the worksheet, the address appears in the input area, but the variable StartAddr gets a null string, as if nothing was filled in on the input area. If I type the address into the input area, it works correctly. What am I missing?