• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

If data is missing, skip a row?

Hi All,


Hope I can get an answer and a solution, I have a pivot table that synchronizes with a report based on selection from the pivot table. There are 1600 rows of data and each row has a unique id which is always from 1-56. Some selections do not have all 1-56 rows of data (1, 3, 5-56) however, the report requires the row id assigned (static) otherwise it brings the wrong row id of data to the the next available row. I would like to see is the correct row id from the pivot table to the correct id in the report , if missing it will skip the row with no data and placed in corresponding row ID.


Example:

Pivot table

ID, School name

1 AA AA

2

3 CC CC


Report:

ID, School name

1 AA AA

2 CC CC

3


I also attached a link to a file


http://sdrv.ms/OELKW3
 
[pre]
Code:
Public Sub ProcessData()
Dim Lastrow As Long
Dim i As Long
Dim cell As Range

Application.ScreenUpdating = False

With ActiveSheet

Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = Lastrow To 2 Step -1

If .Cells(i, "B").Value2 = "" Then

.Cells(i, "B").Resize(, 13).Delete shift:=xlShiftUp
.Rows(i + 1).Delete
End If
Next i
End With

Application.ScreenUpdating = True
End Sub
[/pre]
 
Back
Top