ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find range within a range (https://www.excelbanter.com/excel-programming/323817-find-range-within-range.html)

Tornado

Find range within a range
 
Hi,

I am currently calling a method written in a class in VB 6.0. This method of
the class is called on the form. The method takes a Range (i.e. Excel range
as a parameter). The method is not allowed to except more than this as a
parameter.

Now inside the range passed as a parameter there may or may not be a group
of cells (which themselves are part of a named range (this named range would
always start with letter TG_ but remaining part of the name is not known

I want the piece of code to be written inside this method in class so that
with the given range as parameter, I can scan it and find the cells which
belong to range starting with name as TG_

I am using VB 6.0 with Excel 2000.

Please do let me know if I can provide further inputs.

Thanks

Tim Williams

Find range within a range
 


You can use the .parent.parent of the range parameter to get a
reference to the workbook containing the range.
From there you should be able to figure out what named ranges exist
with names like TG_*.

Then try creating a range using intersect of the passed parameter and
the named range. If you get a result then that will represent the
cells in common to both the named range and the parameter range.


Tim.


"Tornado" wrote in message
...
Hi,

I am currently calling a method written in a class in VB 6.0. This
method of
the class is called on the form. The method takes a Range (i.e.
Excel range
as a parameter). The method is not allowed to except more than this
as a
parameter.

Now inside the range passed as a parameter there may or may not be
a group
of cells (which themselves are part of a named range (this named
range would
always start with letter TG_ but remaining part of the name is not
known

I want the piece of code to be written inside this method in class
so that
with the given range as parameter, I can scan it and find the cells
which
belong to range starting with name as TG_

I am using VB 6.0 with Excel 2000.

Please do let me know if I can provide further inputs.

Thanks





All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com