Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to scrub data

Status
Not open for further replies.

PeteAmsterdam

Programmer
Jun 3, 2005
76
US
Hello - I am very new to VBA and Excel programming. I havew some data that the user would like to sort by color. I need to keep only those real data rows. Here is the data: Where you have the V/ that is the first row I want as well as the rows that follow. I guess you could stop at the total report line that comes accross. Basically, I need to resort this report by COLOR then STYLE.

BB - G-III/BILL BLASS MENS
------------------------------------------
--- SEA/STYLE --- CLR COST INV. ON HAND OPEN ORDERS
UNITS DOLLARS UNITS
----------------------------------------------------------------------------
V/3A11203 MN LAMB ME BLK 64.28 4 257 4
BLK 64.28 4 257 4
BLK 64.28 4 257 4
BLK 64.28 4 257 4
STYLE TOTAL 16 1,028 16
V/3A11664 MN LAMB PE BLK 89.92 11 989 2
BLK 89.92 11 989 2
BLK 89.92 11 989 2


Thanks for any help,
Peter
 
Can you achieve what you wish using the sort from the menu option?

If you can record a macro of yourself doing that and then look at it in the code. That should give you a starting point to work from.

Hope this helps

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 

Looks to me like you could do this using spreadsheet functions.

Construct a record key with a numeric incriment suffix so that by sorting on this key/suffix, the records will 1) sort the way you want and 2) the associated rows will stay together.

The general approch is

If (this row starts with "V") then
Construct the Key
Sequence Nbr = 1
else
Use previous row key
Sequence Nbr = Sequence Nbr + 1
end if



Skip,

[glasses] [red]Be advised:[/red]To be safe on the FOURTH, don't take a FIFTH on the THIRD, or...
You might not come FORTH on the FIFTH! [bomb][tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top