![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 5
|
I have an inventory spreadsheet that I need to expand. For example a row will have information about a part, and lets say in collumn G it has total parts on hand. I am exporting this data to another program that requires one line of data for every part. So if in my spreadsheet I have a row that has say 5 of a given part, I need a way to expand the spreadsheet so I'll have 5 duplicate records for that part instead of one. Any help on how to automatically expand the data in this way would be greatly appreciated.
|
|
|
|
|
|
#2 |
|
Join Date: May 2002
Posts: 20
|
Try this :-
Sub One_Per_Row() Dim r#, x# r = [A65536].End(xlUp).Row For x = r To 2 Step -1 If Cells(x, 7).Value > 1 Then Cells(x, 7).EntireRow.Copy Rows(x + 1).Resize(Cells(x, 7) - 1, 1).Insert Range(Cells(x, 7), Cells(x, 7)(Cells(x, 7), 1)).Value = 1 End If Next End Sub I have assumed that row 1 includes headers and that all other used cells in column G contain numeric data only. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|