When testing code results inconstant. Macro should be adding necessary rows to meet value in Quanity. Ultimately the program will replace all quanties with 1.
Macro to add Rows through out SS based on value in cells
- LVK
- Thread is Unresolved
-
-
-
Here is code I did't add.
Code- Sub InsertBlankRowsBasedOnCellValue()
- LastRow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp)
- For i = LastRow To 2 Step by - 1
- a = Worksheets("Sheet1").Cells(i, 3).Value
- For j = 2 To a
- Worksheets("Sheet1").Rows(i + 1).Select
- Selection.Insert Shift:=xlDown
- Worksheets("Sheet1").Rows(i).Copy
- ActiveSheet.Paste
- Next
- Next
- Worksheets("Sheet1").Cells(1, 1).Select
- End Sub
-
Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post
All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.
How to use code tags
Note: no apostrophe in the tags, just used for demonstration here.
['code]
your code goes between these tags
['/code]
Or, just highlight all of the code and press the <> in the post menu above button to add the code tags.
Thanks.
-
-
Copy rows and paste rows of data when value in Quantity column is above 1 so that a the total number of duplicate rows matches that found in Quantity column.
-
-
LVK,
If the code satisfies your query, please take a moment to mark this thread as resolved.