Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default How to id if range is correct?

One of the things I have the most trouble with in VBA is figuring out
when I'm working with a range, if the range I want to be selected is
the correct one. Doing a watch doesn't help. Is the best way simply to
put in a temporary "range.select" and see if it's the correct one, or
is there a better way?

Thanks again!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to id if range is correct?

More information please ?


--
Regards Ron de Bruin
http://www.rondebruin.nl



"davegb" wrote in message oups.com...
One of the things I have the most trouble with in VBA is figuring out
when I'm working with a range, if the range I want to be selected is
the correct one. Doing a watch doesn't help. Is the best way simply to
put in a temporary "range.select" and see if it's the correct one, or
is there a better way?

Thanks again!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to id if range is correct?

Try, instead,:

MSGBOX(myRange.Address)
--
Gary's Student


"davegb" wrote:

One of the things I have the most trouble with in VBA is figuring out
when I'm working with a range, if the range I want to be selected is
the correct one. Doing a watch doesn't help. Is the best way simply to
put in a temporary "range.select" and see if it's the correct one, or
is there a better way?

Thanks again!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to id if range is correct?

Not sure how you determine the correct range, but

Debug.Assert MyRange.Address=Selection.Address

However, it is seldom necessary to .select objects in order to work with
them, so you may (probably) not need the .select anyway.

NickHK

"davegb" wrote in message
oups.com...
One of the things I have the most trouble with in VBA is figuring out
when I'm working with a range, if the range I want to be selected is
the correct one. Doing a watch doesn't help. Is the best way simply to
put in a temporary "range.select" and see if it's the correct one, or
is there a better way?

Thanks again!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default How to id if range is correct?


NickHK wrote:
Not sure how you determine the correct range, but

Debug.Assert MyRange.Address=Selection.Address

However, it is seldom necessary to .select objects in order to work with
them, so you may (probably) not need the .select anyway.

NickHK


Thanks for all your replies.

What I'm hearing is that VBA doesn't tell the user what range a range
variable represents. You have to do a select or a message box to find
out. That's not what I wanted to hear, but what I need to know!


"davegb" wrote in message
oups.com...
One of the things I have the most trouble with in VBA is figuring out
when I'm working with a range, if the range I want to be selected is
the correct one. Doing a watch doesn't help. Is the best way simply to
put in a temporary "range.select" and see if it's the correct one, or
is there a better way?

Thanks again!


Thanks for all your replies!

What I'm hearing is, the only way to know what range a range variable
is representing is a select or a msgbox, which amount to pretty much
the same thing. There's no built-in feature to id what a range is.



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
How do I correct scroll bar range? Tom Freeman[_2_] Excel Discussion (Misc queries) 3 December 16th 09 04:32 PM
Assign number to correct range blinton25 Excel Discussion (Misc queries) 2 November 17th 06 01:41 PM
Scatter chart not plotting correct range Bruce Charts and Charting in Excel 1 October 7th 06 03:29 AM
Selecting the correct number from a range of cells pajones via OfficeKB.com Excel Worksheet Functions 4 September 18th 06 04:04 PM
How do I correct a range 'reference'? Mike Webb New Users to Excel 3 August 7th 06 12:53 AM


All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"