View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
zach-18[_2_] zach-18[_2_] is offline
external usenet poster
 
Posts: 3
Default Macro to Create a new row if a column contains text

I have a report that a database exports. The first three columns are
customer specific. If a customer has a single order, then only qty1, part1,
and UM1 is populated. (Columns 4, 5, and 6). If a customer has two items to
order, then qty1, part1, UM1, qty2, part2, and UM2 are all populated.
(Columns 1-9).

I've been asked to change the format of the excel file with a macro. In the
event that qty 2 is populated, (a 2nd item exists for the order) then a new
row will be created below the existing row. The customer data (Col 1, 2, 3)
would be copied, and pasted into col 1,2, and 3 of the new row. Then the qty
2, part2, and UM2 data would be moved to the new row and would populate the
qty1, part1, and UM1 columns (Col 4, 5, and 6).

In otherwords, the report would no longer need columns 7, 8, and 9 because
all information would be captured in columns 1-6.

Sorry for the long winded description, but any help that can be provided
would be appreciated. The difficulty for me came in building something that
would "sense" that qty 2 data is present. Also, the macro needs to sense how
many rows the table has and stop after checking the last row.

Kind Regards and Thank You!!