AndyPandy27
Board Regular
- Joined
- Jul 17, 2012
- Messages
- 142
Hi Guys,
I have been searching for an answer to this on this forum, other ones similar, and in my MrExcel VBA and Macros 2010 book, but unfortunately I still haven't had any luck, so thought I would ask away.
Before I get into, I did find this thread - but it didn't quite cover what I wanted, so here goes...
I'm looking to create a UDF called ListItems which will look through a range and create a one column contiguous list of non-blank values.
e.g. below is Range("A1:C3") --> ignore the Column Headers, they're just included for visual reference.
<tbody>
</tbody>
If the user used =ListItems(A1:C3) in cell D1, the result would be:
<tbody>
</tbody>
Couple of things to consider:
1. I appreciate that the user would most likely have to confirm this function with Ctrl+Shift+Enter --> that is fine
2. A UDF might not be the most efficient/suitable solution to this "problem", but I'm currently learning about UDFs, so am more interesting in how they work, than determining the most elegant/correct way to resolve this issue.
3. The order of the resultant values which I have used above (i.e. reading the range passed to the UDF from left to right one row at a time), is not critical, if it is easier to read top to bottom one column at a time, that would be absolutely fine too.
Many thanks indeed,
AP
I have been searching for an answer to this on this forum, other ones similar, and in my MrExcel VBA and Macros 2010 book, but unfortunately I still haven't had any luck, so thought I would ask away.
Before I get into, I did find this thread - but it didn't quite cover what I wanted, so here goes...
I'm looking to create a UDF called ListItems which will look through a range and create a one column contiguous list of non-blank values.
e.g. below is Range("A1:C3") --> ignore the Column Headers, they're just included for visual reference.
Column A | Column B | Column C |
John | Peter | Mary |
Andy | Dave | |
Karen |
<tbody>
</tbody>
If the user used =ListItems(A1:C3) in cell D1, the result would be:
Column D |
John |
Peter |
Mary |
Andy |
Dave |
Karen |
<tbody>
</tbody>
Couple of things to consider:
1. I appreciate that the user would most likely have to confirm this function with Ctrl+Shift+Enter --> that is fine
2. A UDF might not be the most efficient/suitable solution to this "problem", but I'm currently learning about UDFs, so am more interesting in how they work, than determining the most elegant/correct way to resolve this issue.
3. The order of the resultant values which I have used above (i.e. reading the range passed to the UDF from left to right one row at a time), is not critical, if it is easier to read top to bottom one column at a time, that would be absolutely fine too.
Many thanks indeed,
AP