Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Select range through Inputbox

Hello,
I am using the below code to prompt the user to select a range of cells. My
problem is that the resulting range is ignoring any workbook reference. If
you select a range on a different workbook it ignores that in the following
function.

How can I capture the absolute reference?

Thanks in advance!

Set varRange = _
Application.InputBox("Select a range of cells:", Type:=8)
If IsObject(varRange) = False Then Exit Sub

RangeAddress = varRange.Address

' Call nested function to return list of unique items
varUniqList = UniqList(Range(RangeAddress))
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Select range through Inputbox

You can capture the full address, like this
RangeAddress = varRange.Address(External:=True)

[BookName]SheetName!$A$1

Note might get additional apostrophes depending on the names

A better way, rather than pass the address, pass the range object. Then you
can work with

rng.Parent.Parent ' the workbook
rng.Parent ' sheet

but you might not need either the above, simply use the range object.

Regards,
Peter T



"Bythsx-Addagio" wrote in message
...
Hello,
I am using the below code to prompt the user to select a range of cells.
My
problem is that the resulting range is ignoring any workbook reference.
If
you select a range on a different workbook it ignores that in the
following
function.

How can I capture the absolute reference?

Thanks in advance!

Set varRange = _
Application.InputBox("Select a range of cells:", Type:=8)
If IsObject(varRange) = False Then Exit Sub

RangeAddress = varRange.Address

' Call nested function to return list of unique items
varUniqList = UniqList(Range(RangeAddress))



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Select range through Inputbox

Try this change

from:
RangeAddress = varRange.Address
to:
RangeAddress = varRange.Address(External:=True)

"Bythsx-Addagio" wrote:

Hello,
I am using the below code to prompt the user to select a range of cells. My
problem is that the resulting range is ignoring any workbook reference. If
you select a range on a different workbook it ignores that in the following
function.

How can I capture the absolute reference?

Thanks in advance!

Set varRange = _
Application.InputBox("Select a range of cells:", Type:=8)
If IsObject(varRange) = False Then Exit Sub

RangeAddress = varRange.Address

' Call nested function to return list of unique items
varUniqList = UniqList(Range(RangeAddress))

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
Can't Select Range off sheet from inputbox Jim May Excel Discussion (Misc queries) 4 September 29th 07 08:26 PM
Trouble Using InputBox Method to Select Range from Other Sheets pao_e_vinho[_4_] Excel Programming 0 June 23rd 06 11:48 AM
Select range with InputBox. Is it possible? Isabel Excel Programming 3 March 16th 06 07:02 PM
InputBox to select cell locations Michael M Excel Worksheet Functions 5 February 21st 06 05:18 PM
Inputbox - Select ranges cottage6 Excel Programming 2 September 1st 05 07:19 PM


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