Excel Formula to Create Rows Based on qty
Closed
ExcelDummy
-
Jun 1, 2011 at 11:43 PM
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 - Jun 2, 2011 at 02:14 AM
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 - Jun 2, 2011 at 02:14 AM
Related:
- Excel Formula to Create Rows Based on qty
- Number to words in excel formula - Guide
- Excel grade formula - Guide
- Create skype account with gmail - Guide
- Date formula in excel dd/mm/yyyy - Guide
- Create instagram account on pc - Guide
1 response
RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
120
Jun 2, 2011 at 02:14 AM
Jun 2, 2011 at 02:14 AM
Use the Following code it will helps you,
Before that make a copy of your file, because after running the macro you are not able to undo the operation.
Thanks,
Rahul. :)
Before that make a copy of your file, because after running the macro you are not able to undo the operation.
Sub Macro1() Dim i, j, k, l As Long Dim lastrow As Long Sheets(2).Select Rows.Delete Sheets(1).Select lastrow = Range("A" & Rows.Count).End(xlUp).Row If lastrow < 2 Then Exit Sub Rows(1).Select Selection.Copy Sheets(2).Select Rows(1).Select ActiveSheet.Paste For I = 2 To lastrow Sheets(1).Select Range("A" & i, "B" & i).Copy j = Range("C" & i).Value If j = "" Then Exit Sub If j <> 0 Then Sheets(2).Select k = Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row Range("a" & k).Select ActiveSheet.Paste If j > 1 Then Range("A" & k, "B" & k + j - 1).Select Selection.FillDown End If Else Rows(i).Delete I = I - 1 End If Next i Application.DisplayAlerts = False Sheets(1).Delete Application.DisplayAlerts = True End Sub
Thanks,
Rahul. :)