A few years ago I made a blog post on “Inserting duplicate rows based on numeric values in a column”. Click here to view this blog post. I recently had an inquiry on this post from one of my viewers.
A commentor asked about how to copy multiple columns (e.g. Column A:J contains data. Column K is your "# of Test Cases"). In this blog post, I will address this question.
My original blog post only contained data in columns A and B, but what if we have data contained in columns A through J and the “# of test cases” is located in column K as per the screenshot below:
Here is a simple approach for achieving this without needing to even revise the macro.
Step 1] Concatenate columns A through J.
Step 2] Place the concatenated string in column A (copy and paste as text) and the “# of test cases” in column B. Make sure to place them in “Sheet 1” of your spreadsheet or alternatively revise the sheet name in the macro code.
Step 3] Run the macro. Here is the result.
Step 4] Separate the data fields using "text to column" feather in the data tab of the ribbon.
Use hyphen (i.e. “–“) as the delimiter.
It’s all done. Here is the result.
Note] You will need to copy paste the original column headers manually.