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
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