I've searched on Google for hours trying to find an answer to this and for the most part I've come up with some code that does a good job of creating a row after each change in value and copying the row above it. But what I wanted to know was how to change individual cell data within that duplicated row.
So for example:
A B C D 1 ball cat dog elephant 2 ball giraffe zebra apple 3 ball fruit wood ape 4 pumpkin apple pen pencil 5 pumpkin orange lemon grape 6 monkey keyboard mouse can 7 monkey llama chestnuts pill
Looking just at Column A you'll see that there is similar data in groups of rows. I need to create a row after each change in value (so new rows would be created between 3 and 4, 5 and 6, and after 7), the new row would need to COPY everything in in the row immediately above it, and then I'm lost as to what to do next which is editing specific cells to display different data. Here's the code I'm working with:
Please Login or Register to view this content.
This code finds the change in values in Column CC (in my spreadsheet, not pertaining to the example I've given), adds a new row after each change in value, and copies the row above it. I just need to alter some data in the cells after everything is copied. So going back to the example this is what would happen with the code I have now:
A B C D 1 ball cat dog elephant 2 ball giraffe zebra apple 3 ball fruit wood ape 4 ball fruit wood ape 5 pumpkin apple pen pencil 6 pumpkin orange lemon grape 7 pumpkin orange lemon grape 8 monkey keyboard mouse can 9 monkey llama chestnuts pill 10 monkey llama chestnuts pill
Rows 4, 7, and 10 have been added and each copied the row directly above it. The reason I need to do this is because each new line in my spreadsheet is supposed to contain most of the same data as the group of rows above it, just with some minor tweaks. So I thought copying the row and THEN changing data would be the best way to go about it.
So what I need now is to figure out a way to get this code to change values in column B ONLY in the new rows added (not to the whole spreadsheet) to say "cherries" or something, like this:
A B C D 1 ball cat dog elephant 2 ball giraffe zebra apple 3 ball fruit wood ape 4 ball cherries wood ape
You'll see that in row 4 the code added a new row after the change in value in column A (ball), copied everything in the row above it (row 3), and THEN changed the value in column B just in that row to display cherries.
I need to do this for multiple cells as well. I have close to 250 columns and I need the code to change the values in multiple cells after copying the row above it, not just one.
Hopefully that makes some sense. Thanks for any help!
Bookmarks