Digita
07-24-2008, 11:28 PM
All,
I have the following code to prompt user to select a range in a different workbook:
Sub Test()
Dim ThisArea As Range
Again:
On Error GoTo Again
Set ThisArea = Application.InputBox(prompt:="Select a range...", _
Title:="Select a range in a different workbook", Default:=Selection.Address(0, 0), Type:=8)
If ThisArea Is Nothing Then GoTo Again:
ThisArea.Select
End Sub
After a range has been selected, the cellpointer jumps back to the original workbook and asks for a range to be selected again. My understanding is the problem stems from the fact that the range variable is a subset of a sheet which in turn a subset of a workbook (ie the specifics such as: workbook and sheet names are not captured in the variable). Would you have any quick fix for this please?
Thanks in advance
Regards
kp
I have the following code to prompt user to select a range in a different workbook:
Sub Test()
Dim ThisArea As Range
Again:
On Error GoTo Again
Set ThisArea = Application.InputBox(prompt:="Select a range...", _
Title:="Select a range in a different workbook", Default:=Selection.Address(0, 0), Type:=8)
If ThisArea Is Nothing Then GoTo Again:
ThisArea.Select
End Sub
After a range has been selected, the cellpointer jumps back to the original workbook and asks for a range to be selected again. My understanding is the problem stems from the fact that the range variable is a subset of a sheet which in turn a subset of a workbook (ie the specifics such as: workbook and sheet names are not captured in the variable). Would you have any quick fix for this please?
Thanks in advance
Regards
kp