help with reporting writing macro

kssrb

New Member
Joined
Aug 21, 2014
Messages
12
Hello,

I am very new to vba and I am trying to create a report from a workbook with 9 tabs. All 9 tabs have data with blank rows in between so I have the below macro running to delete the blank rows. However, now I want to insert a new sheet called "Summary" and consolidate all the rows from each of the 9 sheets with only columns A, B, C, G, H, I and J. Row 1 is the title for each of the columns so I do not want to repeat that one from each tab. I have searched and googled for this one but with no result. I will appreciate your time and help with this report. Thanks a lot in advance.


Sub deleterows()
Dim i As Long, ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Application.ScreenUpdating = False
With ws.UsedRange
For i = .Rows.Count To 1 Step -1
If .Cells(i, "C") = "PIF" Or .Cells(i, "C") = "pif" Then
.Rows(i).EntireRow.Delete
ElseIf .Cells(i, "C") = "" And .Cells(i, "G") = "" Then
.Rows(i).EntireRow.Delete
ElseIf Application.CountA(Range(.Cells(i, "A"), .Cells(i, "J"))) = 0 Then
.Rows(i).EntireRow.Delete
End If
Next i
End With
Next ws
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,203,436
Messages
6,055,372
Members
444,781
Latest member
rishivar

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