Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Error 424 with inputbox method after OK

Hello,
What is wrong with this very simple code ?

Sub GetAdres()
Dim Last As Range, mes As String
mes = "Select any cell in one of the first 10 rows"
Set Last = Application.InputBox(Prompt:=mes, Type:=8)
MsgBox Last.Address
End Sub

The sub stops on the Set Last.. line after selecting a valid range
and clicking the OK button. Error message = "Error 424 - Object
Required".
I know about error trapping but I don't see any way to trap the error
and still get the required range.
Funny thing is that I used similar code in other subs where it works
fine.
Thanks for any help.
Herman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Error 424 with inputbox method after OK

Nothing. Works fine here -except for the lack of "Cancel" click trapping
(which returns "Object required" btw). Trap that one like this

Sub GetAdres()
Dim Last As Range, mes As String
mes = "Select any cell in one of the first 10 rows"
On Error Resume Next
Set Last = Application.InputBox(Prompt:=mes, Type:=8)
If Last Is Nothing Then Exit Sub
MsgBox Last.Address
End Sub

HTH. Best wishes Harald


"Herman" skrev i melding
m...
Hello,
What is wrong with this very simple code ?

Sub GetAdres()
Dim Last As Range, mes As String
mes = "Select any cell in one of the first 10 rows"
Set Last = Application.InputBox(Prompt:=mes, Type:=8)
MsgBox Last.Address
End Sub

The sub stops on the Set Last.. line after selecting a valid range
and clicking the OK button. Error message = "Error 424 - Object
Required".
I know about error trapping but I don't see any way to trap the error
and still get the required range.
Funny thing is that I used similar code in other subs where it works
fine.
Thanks for any help.
Herman



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
InputBox Method Logic Problem ExcelMonkey[_20_] Excel Programming 2 January 24th 04 04:47 AM
Using Arrays in InputBox Method verizon Excel Programming 4 July 20th 03 08:14 AM
Inputbox method using type:=8 - How to Cancel? Joe 90 Excel Programming 0 July 10th 03 12:24 AM
Inputbox method using type:=8 - How to Cancel? Harlan Grove[_5_] Excel Programming 1 July 9th 03 12:06 AM
Inputbox method using type:=8 - How to Cancel? Jim Cone Excel Programming 0 July 8th 03 06:15 PM


All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"