LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Looking for a more elegant way to program code

I wrote a routine to do the following – and it works fine, but I was
trying to be a bit elegant with my code. Can anyone give me some
direction if the way I wanted to program the routine can be done.

Here’s the problem I was coding a solution for:

I have an array that contains a list of products. For each customer, a
variable number of unique products are pulled and the pull order has
to be maintained. Additionally, the products are grouped for each
customer. So, a code in the form of “X.YY” is created for each
customer, where X is the group 1, 2, 3 … alpha, beta, etc… (alphas
have to follow numerics) . YY is the sequential order of the products
for each individual customer.

So, the data array has the product list going down the rows, while
each column is the specific customer with the X.YY code against those
products that comprise that order.

When I print out any customer’s order, the required format is a
heading for each group (starting with numerics, e.g. “Group 1, Group
2, etc”) and the product list in the sequential order. I accomplished
this by sorting the specific customer column in ascending order,
reading each product into a temporary array (along with the X.YY
code), then running each row of the temp array through a series of
'if' statements to print the product list. As each group is changed
(“X”), a new section header (“Group “ & X) would be printed, followed
by the product list. If the group was an alpha, it would just print
the alpha.

I got the code running with no problems using a number of if
statements (if X= number, if X= alpha, etc) and a lot of redundant
lines of code, but I was hoping to program something that would
recognize the change in group designation and make a few branch
changes, without a whole lot of software repeated.

Any suggestions?

Art

 
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
"=" in text file formatting messes with my code loop- more elegant (and faster) solution? ker_01 Excel Programming 5 July 7th 08 09:32 PM
Is there an elegant way? veryeavy Excel Discussion (Misc queries) 5 February 1st 07 03:30 AM
Need More Elegant Solution - Simple Program [email protected] Excel Programming 4 November 14th 06 06:02 PM
More elegant way to do IF () Barb Reinhardt Excel Worksheet Functions 7 May 6th 06 09:36 AM
More elegant method? Biff Excel Worksheet Functions 0 January 13th 06 08:23 AM


All times are GMT +1. The time now is 05:23 AM.

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"