Littlemalky
Board Regular
- Joined
- Jan 14, 2011
- Messages
- 223
I have data in columns "A:V", with a varying range of data in these columns each week, but the columns and their headers are static. I have a complicated sort and breaks that I use in order to create pivot tables. Anyway, the situation is that I sort column "S" in ascending order and create a break by inserting 4 empty rows when the first 4 appears in that column. Now I have two portions of data, the upper and lower. Now I resort just the upper portion of data by column "V" in descending order. This column is composed of percentages. I need to create another break, preferably inserting 4 rows, for everything less than 100% in column "V" so that only the top portion has 100%+ percentages in it.
My previous code for inserting rows when it finds a 4 is this, so I'm wondering if anyone knows how to adjust it so that it will just use the top portion of data for the percentages part:
My previous code for inserting rows when it finds a 4 is this, so I'm wondering if anyone knows how to adjust it so that it will just use the top portion of data for the percentages part:
Code:
Private Sub Insert_Rows() 'Inserts break between 3 & 4 days late
Dim Found As Range
Dim counter As Long, sMax As Long
sMax = Application.Max(Range("S:S"))
counter = 4
Do
Set Found = Range("S:S").Find(counter, Range("S1"), xlValues, xlWhole, xlByRows, xlNext)
If Not Found Is Nothing Then Found.Resize(4).EntireRow.Insert
counter = counter + 1
Loop Until Not Found Is Nothing Or counter > sMax
'If Found Is Nothing Then MsgBox "Can't find four or larger."
End Sub