![]() |
![]() |
|
|||||||
| 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 |
|
Board Regular
Join Date: Feb 2002
Posts: 422
|
I have 3 columns
Part No Description Qty Ineed a macro to go to column (Qty) and insert that no of rows in, -1 and to copy the data down as well Example A B C 01009 Ram 3 01009 Ram 3 01009 Ram 3 01005 Spacer 2 01005 Spacer 2 010002 Door 1 hope this is clear enough thank you |
|
|
|
|
|
#2 |
|
.
Join Date: Feb 2002
Location: Akron, Ohio USA
Posts: 789
|
Something like this:
Code:
Sub CopyThem()
FinalRow = Cells(65536, 3).End(xlUp).Row
For i = FinalRow To 2 Step -1
ThisQty = Cells(i, 3).Value
If ThisQty > 1 Then
Cells(i + 1, 1).Resize(ThisQty - 1, 1).EntireRow.Insert
Cells(i, 1).Resize(1, 3).Copy _
Destination:=Cells(i + 1, 1).Resize(ThisQty - 1, 3)
End If
Next i
End Sub
Bill
__________________
Preview my latest book for Free |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 422
|
thank you it is just what I wanted
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|