Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50057

Automating content insertion based upon existing data values

$
0
0
I have a large spreadsheet which contains certain key values in a designated column. What I would like to do is insert new line items and insert them with specific content as follows: At the end of each group with a fixed value in Column A, after the last of the rows with the same value in Column A, I want to insert two rows. In the first row, I want the value of Column A to be that of the previous row in Column A f(in essence the value of column A for that group) and the ColumnD value to be 'footer', and in the second row, Id like the value of Column A to be the same as ColumnA of the following (next/subsequent) row (group) and Column D to be the value of 'header' . In essence, I am inserting a header line item and a footer line item around each set of Column As of the same value. All the line items are groups together by their value of column A and are in essence, unique.

I have attached a spreadsheet example. with reference to this spreadsheet, there are both before and after worksheet pages where orange line items represent the first instance of a new column a value and the green and yellow line items are those that are inserted....I only need to populate Column A and D for these rows, the rest I can take care of afterwards. If there is an issue for the very first and last groups in the worksheet, I can address this manually, that is not an issue, but since there are 1000s of line items and hundres of groups, I want to figure out a more efficient manner for the bulk of the sheet.

Any help would be gratefully appreciated. This forum has been very helpful in the past to me.

ExcelForum1.xls

Viewing all articles
Browse latest Browse all 50057

Trending Articles