Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default one row per item one row per order

i have an order history spreadsheet that currently has one line per
item, with multiple orders for each item. i would like to move the data
with a vba macro to end up with one row per order. i would like excel
to check for text in each "orderqty" column in each row. if text
exists, copy columns a, b, and all 6 cells for that order starting with
"ordernum" to the first 8 cells in the first blank row at the bottom of
the sheet.

it should iterate to the right across a row for each column headed by
orderqty, and skip to the next row when it encounters the first blank
orderqty.

i guess i'll need two loops - one as it iterates across column headers,
and one as it iterates down the row.

for an example section of the spreadsheet, see my forum post he
http://www.mrexcel.com/board2/viewtopic.php?t=227255

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default one row per item one row per order

Sub ReorgData()
dim lastrow as Long, rw as Long
Dim i as Long, j as Long
Dim a, b

lastrow = Cells(rows.count,1).End(xlup)(2).Row
rw = lastrow
for i = 1 to lastwor
a = cells(i,1)
b = cells(i,2)
for j = 3 to 256 step 6
if isempty(cells(i,j+2)) then
exit for
else
cells(i,j).Resize(1,6).copy cells(rw,3)
cells(rw,1) = a
cells(rw,2) = b
rw = rw + 1
end if
next j
Next i
End sub

--
Regards,
Tom Ogilvy


" wrote:

i have an order history spreadsheet that currently has one line per
item, with multiple orders for each item. i would like to move the data
with a vba macro to end up with one row per order. i would like excel
to check for text in each "orderqty" column in each row. if text
exists, copy columns a, b, and all 6 cells for that order starting with
"ordernum" to the first 8 cells in the first blank row at the bottom of
the sheet.

it should iterate to the right across a row for each column headed by
orderqty, and skip to the next row when it encounters the first blank
orderqty.

i guess i'll need two loops - one as it iterates across column headers,
and one as it iterates down the row.

for an example section of the spreadsheet, see my forum post he
http://www.mrexcel.com/board2/viewtopic.php?t=227255


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default one row per item one row per order

that works perfectly. (well, other than the "lastwor" typo, but that
was easy to fix.)

thank you for your help!

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
Item numbers result in item description in next field in Excel Cheryl MM Excel Worksheet Functions 1 February 20th 07 03:51 PM
How do I change the order of item in a legend for a chart? Melissa Charts and Charting in Excel 1 October 13th 06 02:50 AM
Can a cell's text order be ahead of a drawn item? xcelentform Excel Discussion (Misc queries) 0 July 26th 06 06:21 PM
Can a cell's text order be ahead of a drawn item? xcelentform Excel Discussion (Misc queries) 0 July 26th 06 05:32 PM
Item order in ListBox [email protected] Excel Discussion (Misc queries) 1 June 16th 06 01:15 PM


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

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"