onedayatatime
New Member
- Joined
- Mar 31, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
I’ve really learned a lot from this forum over the last 5 or so years and seem to figure quite a bit out from the expert guidance but this one has me a bit stumped.
I have a worksheet that has about 90 utilized columns and depending on the week the number of rows containing data is that needs to be manipulated is different. Could be 20 rows one day could be 200 the next. Via VBA I’d like to copy my data set to another worksheet but insert duplicated and slightly modified rows depending if a certain criteria is met.
I’ve simplified the data and will use Fruits and cities in my example. A table (I’m open to how it’s formed, horizontally or vertically, etc.) on its own worksheet will list the fruit and the associated subtypes.
I’ve simplified the data but the ask and example below is if a row contains a specific fruit from the defining table i.e. Apple then duplicate that row based on the number of subtypes listed in the table. Then replace the first Apple reference with the first subtype and so on. If 3 subtypes are listed for the fruit then there will be 3 rows each with the unique subtype. If there are 2 subtypes listed then there will be 2 rows with each of those subtypes.
Starting Dataset
Optimized Dataset: here you can see that since there were 3 apple subtypes identified each time apple comes up there would be now 3 rows each. For Pear since two subtypes were defined, two rows are formed with each of those subtypes.
I have a worksheet that has about 90 utilized columns and depending on the week the number of rows containing data is that needs to be manipulated is different. Could be 20 rows one day could be 200 the next. Via VBA I’d like to copy my data set to another worksheet but insert duplicated and slightly modified rows depending if a certain criteria is met.
I’ve simplified the data and will use Fruits and cities in my example. A table (I’m open to how it’s formed, horizontally or vertically, etc.) on its own worksheet will list the fruit and the associated subtypes.
I’ve simplified the data but the ask and example below is if a row contains a specific fruit from the defining table i.e. Apple then duplicate that row based on the number of subtypes listed in the table. Then replace the first Apple reference with the first subtype and so on. If 3 subtypes are listed for the fruit then there will be 3 rows each with the unique subtype. If there are 2 subtypes listed then there will be 2 rows with each of those subtypes.
Starting Dataset
Optimized Dataset: here you can see that since there were 3 apple subtypes identified each time apple comes up there would be now 3 rows each. For Pear since two subtypes were defined, two rows are formed with each of those subtypes.