Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to find ranges in a sheet

Hi,

There are many ranges in an excel sheet. But some of these ranges being with
letter TG_ and some with letters PG_ . rest of the letters in the name are
not knows. Kindly assist me in finding out which all ranges are there which
start with letter TG_ and after finding that range , how to scan through the
range to read the values present in the cell.

Your assistance is really appreciated.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to find ranges in a sheet

you can do it all at once

Dim rng as Range, rng1 as Range
Dim nm as Name
for each nm in thisworkbook.Names
set rng = Nothing
on Error Resume Next
set rng = nm.RefersToRange
On Error goto 0
if lcase(left(nm.name,2)) = "tg" then
if rng.parent.Name = Activesheet.Name then
msgbox nm.Name & ", " & rng.Address & ": " & rng.Text
if rng1 is nothing then
set rng1 = rng
else
set rng1 = union(rng,rng1)
end if
end if
end if
Next
if not rng1 is nothing then
rng1.Select
end if

--
Regards,
Tom Ogilvy
"Tornado" wrote in message
...
Hi,

There are many ranges in an excel sheet. But some of these ranges being

with
letter TG_ and some with letters PG_ . rest of the letters in the name are
not knows. Kindly assist me in finding out which all ranges are there

which
start with letter TG_ and after finding that range , how to scan through

the
range to read the values present in the cell.

Your assistance is really appreciated.

Thanks



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
Find data in two ranges Santafe Excel Worksheet Functions 2 December 6th 09 02:37 PM
lookup ranges to find commision robert Excel Worksheet Functions 0 January 25th 09 03:16 AM
Find Common names in multi ranges JG Excel Worksheet Functions 4 December 23rd 06 04:28 AM
How do I find all named ranges in VB.NET? John Brock Excel Discussion (Misc queries) 5 September 2nd 05 04:39 PM
selectively copying ranges from one sheet to second sheet JPTIII Excel Programming 1 December 5th 03 08:02 PM


All times are GMT +1. The time now is 05:25 AM.

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"