Inserting Multiple Rows In Very Large Worksheet

bthurman1220

New Member
Joined
Oct 24, 2019
Messages
11
Hoping someone might have some thoughts on optimizing the code below. I am inserting
5 rows each time a new employee is found. Then adding the text for the pay category.

I have done some research and was wondering if "Resize" may be a viable option.

Thanks,

Bob


Code:
X = 2

Do Until Cells(X, 1) = ""




Dim vLoop As Long


    If Cells(X, 10) <> Cells((X + 1), 10) Then
        vLoop = 1
        
        Do While vLoop < 7
        
            Select Case vLoop
            
                Case 1
                    Cells(X, 18) = "BASE SALARY"
                Case 2
                    Cells(X, 18) = "NON-PROFIT BASED BONUS"
                Case 3
                    Cells(X, 18) = "OTHER"
                Case 4
                    Cells(X, 18) = "OVERTIME"
                Case 5
                    Cells(X, 18) = "PROFIT BASED BONUS"
                Case 6
                    Cells(X, 18) = "TOTAL"
                    Exit Do
                    
            End Select
                
            Range(Cells(X, 1), Cells(X, 17)).Select
            Selection.Copy
            Rows(X + 1).Select
            Selection.Insert Shift:=xlDown
            Application.CutCopyMode = False


            vLoop = vLoop + 1
            X = X + 1
            
        Loop
        
        X = X + 1
        
    End If


Loop
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
How many records are in your original database?

Try this

Code:
Sub Inserting_Multiple_Rows_1()
  Dim i As Long, ant As Variant, arr As Variant
  Application.ScreenUpdating = False
  Application.Calculation = xlCalculationManual
  arr = Array("BASE SALARY", "NON-PROFIT BASED BONUS", "OTHER", _
              "OVERTIME", "PROFIT BASED BONUS", "TOTAL")
  For i = Range("J" & Rows.Count).End(xlUp).Row To 2 Step -1
    If ant <> Range("J" & i).Value Then
      Range("A" & i & ":R" & i).Copy
      Range("A" & i + 1 & ":R" & i + UBound(arr)).Insert Shift:=xlDown
      Range("R" & i & ":R" & i + UBound(arr)).Value = Application.Transpose(arr)
    End If
    ant = Range("J" & i).Value
  Next
  Application.Calculation = xlCalculationAutomatic
  Application.CutCopyMode = False
End Sub
 
Upvote 0
Thanks so much DanteAmor. There are 5,397 records to process.
I tried the code and it did not insert any rows.
Thanks again for your help.
 
Upvote 0
According to your macro, employees are in column J and start in row 2.
Isn't that how your data is?
Can you put a sample of how your data is?
If the workbook contains confidential information, you could replace it with generic data.

Did you modify something in the macro? :confused:
 
Upvote 0
DanteAmor - I have a test file but not sure how to post it here. you are correct in that
the employee numbers start in Column "J" and on row 2.
 
Last edited:
Upvote 0
Do you have formulas in column J or values?
Check that you don't have cells with blaks after the last employee in column J.

Perform a test with this data.
<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:21.86px;" /><col style="width:20.91px;" /><col style="width:20.91px;" /><col style="width:21.86px;" /><col style="width:19.96px;" /><col style="width:19.96px;" /><col style="width:21.86px;" /><col style="width:21.86px;" /><col style="width:17.11px;" /><col style="width:40.87px;" /><col style="width:20.91px;" /><col style="width:19.01px;" /><col style="width:24.71px;" /><col style="width:22.81px;" /><col style="width:22.81px;" /><col style="width:20.91px;" /><col style="width:22.81px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td><td >H</td><td >I</td><td >J</td><td >K</td><td >L</td><td >M</td><td >N</td><td >O</td><td >P</td><td >Q</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td><td >H</td><td >I</td><td >J</td><td >K</td><td >L</td><td >M</td><td >N</td><td >O</td><td >P</td><td >Q</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >A2</td><td >B2</td><td >C2</td><td >D2</td><td >E2</td><td >F2</td><td >G2</td><td >H2</td><td >I2</td><td >amor</td><td >K2</td><td >L2</td><td >M2</td><td >N2</td><td >O2</td><td >P2</td><td >Q2</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >A3</td><td >B3</td><td >C3</td><td >D3</td><td >E3</td><td >F3</td><td >G3</td><td >H3</td><td >I3</td><td >amor</td><td >K3</td><td >L3</td><td >M3</td><td >N3</td><td >O3</td><td >P3</td><td >Q3</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >A4</td><td >B4</td><td >C4</td><td >D4</td><td >E4</td><td >F4</td><td >G4</td><td >H4</td><td >I4</td><td >amor</td><td >K4</td><td >L4</td><td >M4</td><td >N4</td><td >O4</td><td >P4</td><td >Q4</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td >A5</td><td >B5</td><td >C5</td><td >D5</td><td >E5</td><td >F5</td><td >G5</td><td >H5</td><td >I5</td><td >dante</td><td >K5</td><td >L5</td><td >M5</td><td >N5</td><td >O5</td><td >P5</td><td >Q5</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td >A6</td><td >B6</td><td >C6</td><td >D6</td><td >E6</td><td >F6</td><td >G6</td><td >H6</td><td >I6</td><td >dante</td><td >K6</td><td >L6</td><td >M6</td><td >N6</td><td >O6</td><td >P6</td><td >Q6</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td >A7</td><td >B7</td><td >C7</td><td >D7</td><td >E7</td><td >F7</td><td >G7</td><td >H7</td><td >I7</td><td >Men</td><td >K7</td><td >L7</td><td >M7</td><td >N7</td><td >O7</td><td >P7</td><td >Q7</td></tr></table>
 
Upvote 0
Do you have formulas in column J or values?
Check that you don't have cells with blaks after the last employee in column J.

Perform a test with this data.
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQ
A2B2C2D2E2F2G2H2I2amorK2L2M2N2O2P2Q2
A3B3C3D3E3F3G3H3I3amorK3L3M3N3O3P3Q3
A4B4C4D4E4F4G4H4I4amorK4L4M4N4O4P4Q4
A5B5C5D5E5F5G5H5I5danteK5L5M5N5O5P5Q5
A6B6C6D6E6F6G6H6I6danteK6L6M6N6O6P6Q6
A7B7C7D7E7F7G7H7I7MenK7L7M7N7O7P7Q7

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:21.86px;"><col style="width:20.91px;"><col style="width:20.91px;"><col style="width:21.86px;"><col style="width:19.96px;"><col style="width:19.96px;"><col style="width:21.86px;"><col style="width:21.86px;"><col style="width:17.11px;"><col style="width:40.87px;"><col style="width:20.91px;"><col style="width:19.01px;"><col style="width:24.71px;"><col style="width:22.81px;"><col style="width:22.81px;"><col style="width:20.91px;"><col style="width:22.81px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]

</tbody>


Here is the starting data:
[TABLE="width: 1216"]
<colgroup><col width="64" span="19" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]A[/TD]
[TD="width: 64"]B[/TD]
[TD="width: 64"]C[/TD]
[TD="width: 64"]D[/TD]
[TD="width: 64"]E[/TD]
[TD="width: 64"]F[/TD]
[TD="width: 64"]G[/TD]
[TD="width: 64"]H[/TD]
[TD="width: 64"]I[/TD]
[TD="width: 64"]J[/TD]
[TD="width: 64"]K[/TD]
[TD="width: 64"]l[/TD]
[TD="width: 64"]m[/TD]
[TD="width: 64"]n[/TD]
[TD="width: 64"]o[/TD]
[TD="width: 64"]p[/TD]
[TD="width: 64"]q[/TD]
[TD="width: 64"]r[/TD]
[TD="width: 64"]s[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD="class: xl63"]B2[/TD]
[TD]C2[/TD]
[TD]D2[/TD]
[TD]E2[/TD]
[TD]F2[/TD]
[TD]G2[/TD]
[TD]H2[/TD]
[TD]I2[/TD]
[TD]amor[/TD]
[TD]K2[/TD]
[TD]L2[/TD]
[TD]M2[/TD]
[TD]N2[/TD]
[TD]O2[/TD]
[TD]P2[/TD]
[TD]Q2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]C3[/TD]
[TD]D3[/TD]
[TD]E3[/TD]
[TD]F3[/TD]
[TD]G3[/TD]
[TD]H3[/TD]
[TD]I2[/TD]
[TD]amor[/TD]
[TD]K3[/TD]
[TD]L3[/TD]
[TD]M3[/TD]
[TD]N3[/TD]
[TD]O3[/TD]
[TD]P3[/TD]
[TD]Q3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]B4[/TD]
[TD]C4[/TD]
[TD]D4[/TD]
[TD]E4[/TD]
[TD]F4[/TD]
[TD]G4[/TD]
[TD]H4[/TD]
[TD]I2[/TD]
[TD]amor[/TD]
[TD]K4[/TD]
[TD]L4[/TD]
[TD]M4[/TD]
[TD]N4[/TD]
[TD]O4[/TD]
[TD]P4[/TD]
[TD]Q4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A5[/TD]
[TD]B5[/TD]
[TD]C5[/TD]
[TD]D5[/TD]
[TD]E5[/TD]
[TD]F5[/TD]
[TD]G5[/TD]
[TD]H5[/TD]
[TD]I2[/TD]
[TD]dante[/TD]
[TD]K5[/TD]
[TD]L5[/TD]
[TD]M5[/TD]
[TD]N5[/TD]
[TD]O5[/TD]
[TD]P5[/TD]
[TD]Q5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A6[/TD]
[TD]B6[/TD]
[TD]C6[/TD]
[TD]D6[/TD]
[TD]E6[/TD]
[TD]F6[/TD]
[TD]G6[/TD]
[TD]H6[/TD]
[TD]I2[/TD]
[TD]dante[/TD]
[TD]K6[/TD]
[TD]L6[/TD]
[TD]M6[/TD]
[TD]N6[/TD]
[TD]O6[/TD]
[TD]P6[/TD]
[TD]Q6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A7[/TD]
[TD]B7[/TD]
[TD]C7[/TD]
[TD]D7[/TD]
[TD]E7[/TD]
[TD]F7[/TD]
[TD]G7[/TD]
[TD]H7[/TD]
[TD]I2[/TD]
[TD]men[/TD]
[TD]K7[/TD]
[TD]L7[/TD]
[TD]M7[/TD]
[TD]N7[/TD]
[TD]O7[/TD]
[TD]P7[/TD]
[TD]Q7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Here is the results. The code I used was exactly what you posted.

[TABLE="width: 1280"]
<colgroup><col width="64" span="20" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]A[/TD]
[TD="width: 64"]B[/TD]
[TD="width: 64"]C[/TD]
[TD="width: 64"]D[/TD]
[TD="width: 64"]E[/TD]
[TD="width: 64"]F[/TD]
[TD="width: 64"]G[/TD]
[TD="width: 64"]H[/TD]
[TD="width: 64"]I[/TD]
[TD="width: 64"]J[/TD]
[TD="width: 64"]K[/TD]
[TD="width: 64"]l[/TD]
[TD="width: 64"]m[/TD]
[TD="width: 64"]n[/TD]
[TD="width: 64"]o[/T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TD]
[TD]G7[/TD]
[TD]H7[/TD]
[TD]I2[/TD]
[TD]men[/TD]
[TD]K7[/TD]
[TD]L7[/TD]
[TD]M7[/TD]
[TD]N7[/TD]
[TD]O7[/TD]
[TD]P7[/TD]
[TD]Q7[/TD]
[TD]TOTAL[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Thanks again. You have no idea how much I appreciate this.
 
Upvote 0
So, does my code work for you?
Did you test my code with your real data?
Improved runtime?
 
Upvote 0
So, does my code work for you?
Did you test my code with your real data?
Improved runtime?

Code is still not working perfectly. Below is what I expect to see after running the code
and you can see from my results above this is not happening.

[TABLE="width: 1280"]
<colgroup><col width="64" span="20" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]A[/TD]
[TD="width: 64"]B[/TD]
[TD="width: 64"]C[/TD]
[TD="width: 64"]D[/TD]
[TD="width: 64"]E[/TD]
[TD="width: 64"]F[/TD]
[TD="width: 64"]G[/TD]
[TD="width: 64"]H[/TD]
[TD="width: 64"]I[/TD]
[TD="width: 64"]J[/TD]
[TD="width: 64"]K[/TD]
[TD="width: 64"]l[/TD]
[TD="width: 64"]m[/TD]
[TD="width: 64"]n[/TD]
[TD="width: 64"]o[/TD]
[TD="width: 64"]p[/TD]
[TD="width: 64"]q[/TD]
[TD="width: 64"]r[/TD]
[TD="width: 64"]s[/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD="class: xl65"]B2[/TD]
[TD]C2[/TD]
[TD]D2[/TD]
[TD]E2[/TD]
[TD]F2[/TD]
[TD]G2[/TD]
[TD]H2[/TD]
[TD]I2[/TD]
[TD]amor[/TD]
[TD]K2[/TD]
[TD]L2[/TD]
[TD]M2[/TD]
[TD]N2[/TD]
[TD]O2[/TD]
[TD]P2[/TD]
[TD]Q2[/TD]
[TD="colspan: 2"]BASE SALARY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD="class: xl65"]B2[/TD]
[TD]C2[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]
[TD]A7[/TD]
[TD]B7[/TD]
[TD]C7[/TD]
[TD]D7[/TD]
[TD]E7[/TD]
[TD]F7[/TD]
[TD]G7[/TD]
[TD]H7[/TD]
[TD]I2[/TD]
[TD]men[/TD]
[TD]K7[/TD]
[TD]L7[/TD]
[TD]M7[/TD]
[TD]N7[/TD]
[TD]O7[/TD]
[TD]P7[/TD]
[TD]Q7[/TD]
[TD="colspan: 3"]PROFIT BASED BONUS[/TD]
[/TR]
[TR]
[TD]A7[/TD]
[TD]B7[/TD]
[TD]C7[/TD]
[TD]D7[/TD]
[TD]E7[/TD]
[TD]F7[/TD]
[TD]G7[/TD]
[TD]H7[/TD]
[TD]I2[/TD]
[TD]men[/TD]
[TD]K7[/TD]
[TD]L7[/TD]
[TD]M7[/TD]
[TD]N7[/TD]
[TD]O7[/TD]
[TD]P7[/TD]
[TD]Q7[/TD]
[TD]TOTAL[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Thanks again.
 
Upvote 0
Does this example work for you?

Perform a test with this data.
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQ
A2B2C2D2E2F2G2H2I2amorK2L2M2N2O2P2Q2
A3B3C3D3E3F3G3H3I3amorK3L3M3N3O3P3Q3
A4B4C4D4E4F4G4H4I4amorK4L4M4N4O4P4Q4
A5B5C5D5E5F5G5H5I5danteK5L5M5N5O5P5Q5
A6B6C6D6E6F6G6H6I6danteK6L6M6N6O6P6Q6
A7B7C7D7E7F7G7H7I7MenK7L7M7N7O7P7Q7

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]7[/TD]

</tbody>

If you run the macro more than once the table grows and grows.

Only run the test once and review the results.

------------------------------------------------------------------------------------
If it is not what you need then upload a file to the cloud with 2 sheets on sheet1 you put your original table and on sheet2 you put the expected result.

You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,171
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top