Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA function for having excel find range automatically.

Hi,

I would like Excell to give me a range of cells for a value.
Sort of like VLOOKUP, only when Excell finds the item, it will not giv
me a value for it, but a range of cells that associated with this item
This range will vary in length for each item.

For example when it finds the word: "VCR" in cell A4, it will give m
the range that is associated with it: C5:E9.
and when it finds the word: "TV" in cell A11, it will give me the rang
that is associated with it: C12:G40.

As you can see, the range is not the same for each one of these items.


Is there a VBA function I need to write in order for excell to do this

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default VBA function for having excel find range automatically.

Hi
your example is a little bit strange as I do not know how you come from
cell A4 to the range C5:E9. If you can explain this algortihm a
solution may be provided to you.


--
Regards
Frank Kabel
Frankfurt, Germany

Hi,

I would like Excell to give me a range of cells for a value.
Sort of like VLOOKUP, only when Excell finds the item, it will not
give me a value for it, but a range of cells that associated with
this item. This range will vary in length for each item.

For example when it finds the word: "VCR" in cell A4, it will give me
the range that is associated with it: C5:E9.
and when it finds the word: "TV" in cell A11, it will give me the
range that is associated with it: C12:G40.

As you can see, the range is not the same for each one of these

items.


Is there a VBA function I need to write in order for excell to do
this?


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA function for having excel find range automatically.

Hi Frank

It's just like in VLOOKUP. When excell finds a certain text, ie "VCR
it will return the range, which will always start one raw down an
three columns across. The range varies for each item, it will alway
have the same number of columns, however a differenct number of raws i
it.

I have attached a file to explain what I need.


ronenpl wrote:
*Hi,

I would like Excell to give me a range of cells for a value.
Sort of like VLOOKUP, only when Excell finds the item, it will no
give me a value for it, but a range of cells that associated wit
this item. This range will vary in length for each item.

For example when it finds the word: "VCR" in cell A4, it will give m
the range that is associated with it: C5:E9.
and when it finds the word: "TV" in cell A11, it will give me th
range that is associated with it: C12:G40.

As you can see, the range is not the same for each one of thes
items.

Is there a VBA function I need to write in order for excell to d
this?


Attachment filename: range test.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=45856
--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default VBA function for having excel find range automatically.

Hi
not sure what you want with this returned range. But to give you
anexample: If you want to sum this range you may use the following
array entered (CTRL+SHIFT+ENTER) formula (Assumption: F1 stores the
lookup item, e.g. "vcr")

=SUM(OFFSET($C$1:$E$1,MATCH(F1,$A$1:$A$1000,0),0,M ATCH(TRUE,ISBLANK(OFF
SET($C$1,MATCH(F1,$A$1:$A$1000,0),0,100)),0)-1))


--
Regards
Frank Kabel
Frankfurt, Germany

Hi Frank

It's just like in VLOOKUP. When excell finds a certain text, ie

"VCR"
it will return the range, which will always start one raw down and
three columns across. The range varies for each item, it will

always
have the same number of columns, however a differenct number of raws
in it.

I have attached a file to explain what I need.


ronenpl wrote:
*Hi,

I would like Excell to give me a range of cells for a value.
Sort of like VLOOKUP, only when Excell finds the item, it will not
give me a value for it, but a range of cells that associated with
this item. This range will vary in length for each item.

For example when it finds the word: "VCR" in cell A4, it will give

me
the range that is associated with it: C5:E9.
and when it finds the word: "TV" in cell A11, it will give me the
range that is associated with it: C12:G40.

As you can see, the range is not the same for each one of these
items.

Is there a VBA function I need to write in order for excell to do
this? *


Attachment filename: range test.xls
Download attachment:
http://www.excelforum.com/attachment.php?postid=458568 ---
Message posted from http://www.ExcelForum.com/


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA function for having excel find range automatically.

Hi Frank,

Thanks alot. You helped me alot

--
Message posted from http://www.ExcelForum.com

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
Automatically display filter range in report header in Excel Kjetil Excel Worksheet Functions 3 October 24th 06 03:08 PM
How can I find and format specific cells automatically in Excel? Amy Excel Worksheet Functions 1 August 6th 05 03:00 PM
How do I automatically update a chart range in Excel Quinton Excel Discussion (Misc queries) 1 July 27th 05 12:57 PM
Using the Find function with the What referencing a Range/Cell Value PFederinko Excel Programming 1 February 9th 04 03:13 PM
excel 97 : automatically inserting a specific value for a range? JMCN Excel Programming 3 September 30th 03 04:25 PM


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