Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
naz naz is offline
external usenet poster
 
Posts: 1
Default user input of a range of cells

How do I initiate a user input of a range of cells after clicking a
visual object? I want the program to pause whilst the user selects a
range of cells on the worksheet whcih will be used later to input a
file directory.

I appreciate any help.

Thanks Naim.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default user input of a range of cells


naz wrote:
How do I initiate a user input of a range of cells after clicking a
visual object? I want the program to pause whilst the user selects a
range of cells on the worksheet whcih will be used later to input a
file directory.

I appreciate any help.

Thanks Naim.


Here is an example to test. Enter the following into any worksheet
code module you want and then simply double click that worksheet to run
the test. If this does what you want just take the code out of the
worksheet and adapt it to your needs.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim Answer As String
Dim ProcRng As Range

Cancel = True
On Error GoTo Handler

GetAddress:
Answer = InputBox("Please enter the range of cells to be
processed:")
Set ProcRng = Range(Answer)
ProcRng.Select
MsgBox "You have selected the range(" & ProcRng.Address & ") for
use in this example."
Target.Select
Exit Sub
Handler:
If Err.Number = 1004 Then 'Application-defined or
object-defined error
MsgBox "Your entry was invalid, please try again."
GoTo GetAddress
End If
MsgBox Err.Description
End Sub

If ya need anything give a shout. I should be here another couple of
hours

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default user input of a range of cells

Naim,
You can provide the user with an InputBox, with appropriate prompt and
Type:=8

Dim rng As Range
Const RangeOnly As Long = 8
Set rng = Application.InputBox("Select your cells", , , , , , , RangeOnly)

Add error trapping to check for cancel.

NickHK

"naz" wrote in message
oups.com...
How do I initiate a user input of a range of cells after clicking a
visual object? I want the program to pause whilst the user selects a
range of cells on the worksheet whcih will be used later to input a
file directory.

I appreciate any help.

Thanks Naim.



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
Taking range as input from the User jn_mohit Excel Programming 1 July 8th 05 04:26 PM
User input as a range. What am I doing wrong? Irada Shamilova[_2_] Excel Programming 0 October 26th 04 08:34 AM
User input as a range. What am I doing wrong? Irada Shamilova Excel Programming 1 October 25th 04 04:23 PM
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 06:16 PM.

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"