Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Taking range as input from the User | Excel Programming | |||
User input as a range. What am I doing wrong? | Excel Programming | |||
User input as a range. What am I doing wrong? | Excel Programming | |||
User input as a range | Excel Programming | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |