antonismouf
Board Regular
- Joined
- Aug 18, 2015
- Messages
- 64
Hello all,
I am using a code to identify the value of a cell and then copy its row and insert it above x times depending on the value of the cell. The code is working ok but it is taking a significant amount of time to complete. Does anyone have a suggestion on how I can speed this up?
I found this post: http://www.mrexcel.com/forum/excel-...cations-insert-entire-rows-large-numbers.html but I cant understand what mirabeaus code is doing so I can modify it.
This is the code I am using:
Regards
Antonis
I am using a code to identify the value of a cell and then copy its row and insert it above x times depending on the value of the cell. The code is working ok but it is taking a significant amount of time to complete. Does anyone have a suggestion on how I can speed this up?
I found this post: http://www.mrexcel.com/forum/excel-...cations-insert-entire-rows-large-numbers.html but I cant understand what mirabeaus code is doing so I can modify it.
This is the code I am using:
Code:
Sub Populate_Adj()
Dim lastRw As Long
Dim lastRw1 As Long
Dim colAmnt As String
lastRw = Cells(Rows.Count, "A").End(xlUp).Row
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
For nxtRw = lastRw + 1 To 2 Step -1
Select Case Cells(nxtRw, 1).Value
Case "035T"
If Cells(nxtRw, "A").Font.Bold = False Then
For Ins_RW = 1 To 5
Cells(nxtRw, "A").EntireRow.Copy
Cells(nxtRw, "A").Insert
Next
End If
Case "135T"
If Cells(nxtRw, "A").Font.Bold = False Then
For Ins_RW = 1 To 10
Cells(nxtRw, "A").EntireRow.Copy
Cells(nxtRw, "A").Insert
Next
End If
End Select
Next
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
End With
End Sub
Regards
Antonis