Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Dialog for selecting range within subroutine

Excel 2007

Is there a dialog which I can call within a subroutine which would ask the
user to select with the mouse a range of cells and place the result in a
variable?

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Dialog for selecting range within subroutine

Sub rng()
Set myRange = Application.InputBox("Enter a range or " _
& "select a range with the mouse.", _
"SELECT A RANGE", Type:=8)
MsgBox myRange.Address
End Sub

"John" wrote in message
...
Excel 2007

Is there a dialog which I can call within a subroutine which would ask the
user to select with the mouse a range of cells and place the result in a
variable?

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Dialog for selecting range within subroutine

Excel 2007

Dialog for selecting range
Is there a dialog which I can call within a subroutine which would ask the
user to select with the mouse a range of cells and place the result in a
variable?

http://www.ozgrid.com/forum/showthread.php?t=64872
Is there a built-in dialog box that allows the user to select a range by
clicking and dragging with the mouse? I'd like to use this in my code and
have the dialog box return either a range object or and address that I can
use in a range assignment statement. I'm looking for something like what you
get when you select Insert--Name--Define. The "Refers To" text box at the
bottom automatically updates as the user clicks and drags across cells. Is
there such a thing accessible via VBA?

Answer
http://msdn.microsoft.com/en-us/library/bb209950.aspx

Dim rng As Range
Set rng = Application.InputBox("Select cell(s)",type:=8)

Note : VB: AutoLinked keywords will cause extra spaces before keywords.
Extra spacing is NOT transferred when copy/pasting, but IS if the keyword
uses "quotes".

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
deleting cell range in a worksheet_change subroutine NDBC Excel Programming 4 September 4th 09 03:13 AM
Worksheet Cell Range Name within VB Subroutine Jay Somerset Excel Discussion (Misc queries) 5 February 6th 06 02:27 PM
Selecting a file from dialog Avi Excel Programming 1 October 31st 05 04:49 PM
subroutine to get all of the Named range properties Arishy[_2_] Excel Programming 3 June 30th 05 03:34 PM
Selecting Cells using dialog box Todd Huttenstine Excel Programming 3 December 16th 04 05:12 PM


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