Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User input as a range. What am I doing wrong?


Hi!

I have found here the hint on Application.Inputbox(type:=8) & copie
the whole VBA code to try it. But I keep getting run-time error 42
message that Object is required. What is that I'm doing wrong?

Sub testme()

Dim rng As Range
'On Error Resume Next
Set rng = Application.InputBox("Select a Range..", Type:=8)
On Error GoTo 0
If rng Is Nothing Then
Exit Sub 'cancelled
Else
MsgBox rng.Address
End If
End Sub

Thanks in advance.
Irad

--
Irada Shamilov
-----------------------------------------------------------------------
Irada Shamilova's Profile: http://www.excelforum.com/member.php...fo&userid=1228
View this thread: http://www.excelforum.com/showthread.php?threadid=27209

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default User input as a range. What am I doing wrong?

Hi
your code works for me. I only get this error if I cancel the inputbox. and
this is easily solved if you use
on error resume next (remove the apostrophe before this statement)

"Irada Shamilova" wrote:


Hi!

I have found here the hint on Application.Inputbox(type:=8) & copied
the whole VBA code to try it. But I keep getting run-time error 424
message that Object is required. What is that I'm doing wrong?

Sub testme()

Dim rng As Range
'On Error Resume Next
Set rng = Application.InputBox("Select a Range..", Type:=8)
On Error GoTo 0
If rng Is Nothing Then
Exit Sub 'cancelled
Else
MsgBox rng.Address
End If
End Sub

Thanks in advance.
Irada


--
Irada Shamilova
------------------------------------------------------------------------
Irada Shamilova's Profile: http://www.excelforum.com/member.php...o&userid=12286
View this thread: http://www.excelforum.com/showthread...hreadid=272097


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
Trying to select a specific range based on the time value of user form input Jitranijam New Users to Excel 8 November 15th 06 12:52 AM
user input decides cell copy range beatrice25 Excel Discussion (Misc queries) 0 May 17th 06 06:51 PM
histogram, wrong input range Camilla Excel Discussion (Misc queries) 1 November 11th 05 07:21 AM
User input as a range Shane Excel Programming 2 October 13th 04 02:31 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 09:35 AM.

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

About Us

"It's about Microsoft Excel"