Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Best way to make column lists out of row of cells?

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)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Best way to make column lists out of row of cells?

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
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
How do I make a formula work for all the cells in a column? Janelle Excel Discussion (Misc queries) 4 February 4th 10 11:05 PM
How to make a column of cells have a drop down menu Alzheimer'sResearch Excel Worksheet Functions 3 October 2nd 08 02:07 AM
Can I make 1 cell the SUM of other cells in the row, for whole column? [email protected] Excel Discussion (Misc queries) 3 January 23rd 08 01:44 AM
make column lists for select query. kang New Users to Excel 1 July 16th 07 01:32 PM
How do I make 2 cells become one without changing column size milo1339 Excel Discussion (Misc queries) 9 June 25th 06 10:39 PM


All times are GMT +1. The time now is 03:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"