Printing only rows with data?

Amy81

New Member
Joined
Nov 14, 2019
Messages
1
Hi all! I'm pretty sure this may have been answered before, but I'm self-taught in excel and know about 100% of nothing as far as coding goes, so I need to try an get this explained super simply if possible. The post I think I found before talked a lot about coding and something like VBA and I don't have a clue what to do with that so I didn't want to try anything and end up breaking my work computer.

I have aspreadsheet and would like to know if it’s possible to only print the rows I adddata to. Right now, the sheet lookslike:

Amount
Material #
Description
Catalog
1
350546
BELT, BLACK, SAM BROWN,26
LCE
3
350547
BELT, BLACK, SAM BROWN,28
FM
4
350548
BELT, BLACK, SAM BROWN,30
FM
350549
BELT, BLACK, SAM BROWN,32
350550
BELT, BLACK, SAM BROWN,34

<tbody>
</tbody>

There are about 2000 rows total in the document, so I’d really liketo have it only print the title line and the rows where there’s an amountlisted to save paper each time I have to print it. It this possible and anywhere close to easyto do? Would this be easier to do inAccess maybe?


Thank you all so much for your time and help!!!!
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

OaklandJim

Board Regular
Joined
Nov 29, 2018
Messages
51
Office Version
2019
Platform
Windows
Hi all! I'm pretty sure this may have been answered before, but I'm self-taught in excel and know about 100% of nothing as far as coding goes, so I need to try an get this explained super simply if possible. The post I think I found before talked a lot about coding and something like VBA and I don't have a clue what to do with that so I didn't want to try anything and end up breaking my work computer.

I have aspreadsheet and would like to know if it’s possible to only print the rows I adddata to. Right now, the sheet lookslike:

AmountMaterial #DescriptionCatalog
1350546BELT, BLACK, SAM BROWN,26LCE
3350547BELT, BLACK, SAM BROWN,28FM
4350548BELT, BLACK, SAM BROWN,30FM
350549BELT, BLACK, SAM BROWN,32
350550BELT, BLACK, SAM BROWN,34

<tbody>
</tbody>

There are about 2000 rows total in the document, so I’d really liketo have it only print the title line and the rows where there’s an amountlisted to save paper each time I have to print it. It this possible and anywhere close to easyto do? Would this be easier to do inAccess maybe?


Thank you all so much for your time and help!!!!
Try this in a new module. My code is not model quality. I tend to be too verbose and explicit for most programmers.


Option Explicit


' Global constant containing textual value for the range
' Code assumes that row 1 of the range is headers
Const gsPrintRange = "C8:F25"
'


Sub HideRowsWithoutAmount()


Dim wsSheet As Worksheet

Dim rDataRange As Range

Dim iRows As Long

Dim iLoopRow As Long

Set wsSheet = Worksheets("Sheet1")

Set rDataRange = wsSheet.Range(gsPrintRange)

iRows = rDataRange.Rows.Count

' Characterize the range to loop through.
' It is the first column in the data.
' Start at row 2 assuming row 1 of the range
' contains column headers.


Dim rParseRange As Range
Set rParseRange = rDataRange.Cells(2, 1).Resize(iRows - 1, 1)


With rParseRange
For iLoopRow = 1 To iRows

' Cint ensures that we are testing a numeric
If CInt(.Cells(iLoopRow, 1).Value) = 0 _
Then

'Check for empty row, ignore them
If .Cells(iLoopRow, 2).Value <> "" _
Then
.Cells(iLoopRow).EntireRow.Hidden = True
End If

End If

Next 'iLoopRow

End With 'rParseRange


End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
40,623
Office Version
365
Platform
Windows
Hi & welcome to MrExcel.
Why not just use the Autofilter function found on the Data tab and filter for non blanks?
 

Watch MrExcel Video

Forum statistics

Threads
1,099,013
Messages
5,466,026
Members
406,461
Latest member
Garrus

This Week's Hot Topics

Top