PC Review


Reply
Thread Tools Rate Thread

Best way to make column lists out of row of cells?

 
 
Ed from AZ
Guest
Posts: n/a
 
      7th Sep 2007
I need to create a header row in a new worksheet based on user
choices. I have all the possible choices in one "master" row - each
cell is already formatted for color, border, column width, font, etc,
and the program will take the ones chosen by the user and copy them
onto a new sheet. Data will later be added, so getting the proper
headers up front is a bit important.

The individual column headings can be separated into a couple of
different data categories, and there is always the possibility that a
user will want choices not yet there that fit a different category.
The question I have is how to list all these headings in different
columns based on their data category. The data category for each
individual heading would be contained in a comment in that cell.

The complete composite header row stretches from A1 to AD1 at the
moment; more will likely be added later. I'd like to go to CA1, put
the data category name, and write all headers for that category in CA2
and down; go to CC1, put the next category name, all headers for that
category in CC2 and down; lather, rinse, repeat for all categories.
All this would be in a Workbook_Open sub.

My general fuzzy idea goes something like this:
-- Iterate through the cells of the whole header row.
-- Read the comment text of each cell to get the category.
-- Write the text of the header cell in the column for the proper
category.

The tough part is not knowing how many categories there are or what
their names are, because things will get added as we go along. That
means I have to track which categories have been created; if this next
one has not been created yet, then go to the next column over and
create it, then write the header under it. (The user will then scan
these lists, put an X by the desired headers, and click a button to
build the desired header row n a new worksheet. That part I think I
can handle.)

Do I create an array variable on the fly for each category, and then
iterate through all my arrays to write each one to the worksheet? Is
there a better way to track "categories created" so I know when I hit
a new one? How would y'all approach this?

Ed
(Working in XL2003)

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      8th Sep 2007
I would do it in rows rather than in columns.

I would make column A the category and put the category name in the first
row only of each category. Then you can search down column A and skip blank
calell to find each category

The in column B I would put the column letter where the category will go.

The in column C I would put the heading name with the proper format.

I would also rather than use the comments put additional info in differnt
column (D, E, f, ...)

I would make a listbox and put the categories into the list box alphetized.
You can use a userform and two list boxes. When the category is selected in
the first box display all the headings in the 2nd box. This is a little bit
more complicated but the results really gets peoples attention.

I did something like this for another posting this week and it turned out
really great.
"Ed from AZ" wrote:

> I need to create a header row in a new worksheet based on user
> choices. I have all the possible choices in one "master" row - each
> cell is already formatted for color, border, column width, font, etc,
> and the program will take the ones chosen by the user and copy them
> onto a new sheet. Data will later be added, so getting the proper
> headers up front is a bit important.
>
> The individual column headings can be separated into a couple of
> different data categories, and there is always the possibility that a
> user will want choices not yet there that fit a different category.
> The question I have is how to list all these headings in different
> columns based on their data category. The data category for each
> individual heading would be contained in a comment in that cell.
>
> The complete composite header row stretches from A1 to AD1 at the
> moment; more will likely be added later. I'd like to go to CA1, put
> the data category name, and write all headers for that category in CA2
> and down; go to CC1, put the next category name, all headers for that
> category in CC2 and down; lather, rinse, repeat for all categories.
> All this would be in a Workbook_Open sub.
>
> My general fuzzy idea goes something like this:
> -- Iterate through the cells of the whole header row.
> -- Read the comment text of each cell to get the category.
> -- Write the text of the header cell in the column for the proper
> category.
>
> The tough part is not knowing how many categories there are or what
> their names are, because things will get added as we go along. That
> means I have to track which categories have been created; if this next
> one has not been created yet, then go to the next column over and
> create it, then write the header under it. (The user will then scan
> these lists, put an X by the desired headers, and click a button to
> build the desired header row n a new worksheet. That part I think I
> can handle.)
>
> Do I create an array variable on the fly for each category, and then
> iterate through all my arrays to write each one to the worksheet? Is
> there a better way to track "categories created" so I know when I hit
> a new one? How would y'all approach this?
>
> Ed
> (Working in XL2003)
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I am trying to Make a column on Top 4 Cells, and Under 5 Cells. Cpatimevalue Microsoft Excel Misc 1 10th Jun 2009 03:49 AM
How to make a column of cells have a drop down menu Alzheimer'sResearch Microsoft Excel Worksheet Functions 3 2nd Oct 2008 02:07 AM
Can I make 1 cell the SUM of other cells in the row, for whole column? ato_zee@hotmail.com Microsoft Excel Misc 3 23rd Jan 2008 01:44 AM
Is it possible to make all cells in a column have the same formula? shans91@hotmail.com Microsoft Excel Discussion 8 23rd Dec 2007 08:05 PM
make column lists for select query. kang Microsoft Excel New Users 1 16th Jul 2007 01:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:56 AM.