Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default InputBoxes & Ranges

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?

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
Ranges & Inputboxes? Faraz A. Qureshi Excel Programming 4 September 11th 09 09:33 AM
userform and inputboxes pswanie Excel Programming 1 January 3rd 08 04:09 PM
connecting 2 inputboxes and using the autofill Mike Excel Programming 4 September 29th 06 12:37 PM
InputBoxes Sean Excel Programming 2 July 19th 06 06:09 PM
InputBoxes Exceptions ianripping[_42_] Excel Programming 3 April 8th 04 09:34 PM


All times are GMT +1. The time now is 04: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"