How to print only rows /cells with data in Excel?
When printing a range or a worksheet in Excel, some blank rows or blank cells are also printed out and take up spaces in papers. This article is talking about how to ignore all blank rows/cells and only print rows/cells with data in Excel.
This method will introduce a VBA to quickly print rows with data only in a specified range in Excel. Please do as follows:
1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then copy and paste the following VBA code into the new opening Module window.
VBA: Print only rows with data in Excel
Sub PrintSummary() Dim xRg As Range, xRg1 As Range, xCell As Range Dim xSht As Worksheet Dim xTxt As String On Error Resume Next xTxt = ActiveWindow.RangeSelection.Address Set xRg = Application.InputBox("Please select the range to print:", "Kutools for Excel", xTxt, , , , , 8) Set xRg = Application.Intersect(xRg, ActiveSheet.UsedRange) If xRg Is Nothing Then Exit Sub If xRg.Areas.Count > 1 Then MsgBox "You can't select multiple selections", , "Kutools for Excel" Exit Sub End If Application.DisplayAlerts = False Application.ScreenUpdating = False Set xSht = Worksheets.Add(After:=Sheets(Sheets.Count)) xRg.Copy xSht.Range("A1") Set xRg1 = xSht.Range("A1").Resize(xRg.Rows.Count, xRg.Columns.Count) For Each xCell In xRg1.Columns(1).Cells If Application.WorksheetFunction.CountA(xCell.EntireRow) = 0 Then xCell.EntireRow.Hidden = True End If Next xSht.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False xSht.Delete Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub
3. Press the F5 key or click the Run button to run this VBA.
4. In the opening Kutools for Excel dialog box, specify the range that you want to ignore blank rows and only print rows with data, and click the OK button.
Then the specified range is printed immediately with ignoring all blank rows in it.
Note: This VBA does not support batch print multiple selections with ignoring blank rows.
This method introduce Kutools for Excel’s Delete Blank Rows utility to delete all blank cells in active worksheet or selected range, and then print those rows with data only in Excel. Please do as follows:
1. Go to the worksheet you will print rows with data only, and click Kutools > Delete > Delete Blank Rows > In Active Sheet. See screenshot:
Note: For printing rows with data only in a specified range, please select this range firstly, and then click Kutools > Delete > Delete Blank Rows > In Selected Range.
2. A Kutools for Excel dialog box will pop up and show you how many blank rows have been deleted. Click the OK button to close it.
And now you will see all blank rows are deleted from the active worksheet/selected range. See screenshot:
3. Click the File (or Office Button) > Print to print only rows with data in active worksheet or selected range.
Sometimes, you may want to print cells with data only with ignoring all blank cells in Excel. This method will introduce Kutools for Excel’s Select Nonblank Cells utility and Print Multiple Selections Wizard to only print cells with data in specified range in Excel.
1. Select the range where you will only print the cells with data, and click Kutools > Select > Select Nonblank Cells. See screenshot:
2. A Kutools for Excel dialog box comes out and show you how many cells with data have been selected. Click the OK button to close it.
3. Keep selecting these nonblank cells, and click Enterprise > Printing > Print Multiple Selections Wizard. See screenshot:
4. In the opening Print Multiple Selections Wizard dialog box, you will see all selected nonblank cells are listing in the Ranges to print list, please click the Finish button.
5. Now all selected nonblank cells are copied and pasted as linked pictures in a new worksheet. Please click File (or Office button) > Print to print these cells with data.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!