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:

[TABLE="width: 339"]
<tbody>[TR]
[TD="width: 75, bgcolor: transparent"]Amount
[/TD]
[TD="width: 89, bgcolor: transparent"]Material #
[/TD]
[TD="width: 217, bgcolor: transparent"]Description
[/TD]
[TD="width: 71, bgcolor: transparent"]Catalog
[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"]1
[/TD]
[TD="width: 89, bgcolor: transparent"]350546
[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,26
[/TD]
[TD="width: 71, bgcolor: transparent"]LCE
[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"]3
[/TD]
[TD="width: 89, bgcolor: transparent"]350547
[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,28
[/TD]
[TD="width: 71, bgcolor: transparent"]FM
[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"]4
[/TD]
[TD="width: 89, bgcolor: transparent"]350548
[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,30
[/TD]
[TD="width: 71, bgcolor: transparent"]FM
[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 89, bgcolor: transparent"]350549
[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,32
[/TD]
[TD="width: 71, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 89, bgcolor: transparent"]350550
[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,34
[/TD]
[TD="width: 71, bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]

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!!!!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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:

[TABLE="width: 339"]
<tbody>[TR]
[TD="width: 75, bgcolor: transparent"]Amount[/TD]
[TD="width: 89, bgcolor: transparent"]Material #[/TD]
[TD="width: 217, bgcolor: transparent"]Description[/TD]
[TD="width: 71, bgcolor: transparent"]Catalog[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"]1[/TD]
[TD="width: 89, bgcolor: transparent"]350546[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,26[/TD]
[TD="width: 71, bgcolor: transparent"]LCE[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"]3[/TD]
[TD="width: 89, bgcolor: transparent"]350547[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,28[/TD]
[TD="width: 71, bgcolor: transparent"]FM[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"]4[/TD]
[TD="width: 89, bgcolor: transparent"]350548[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,30[/TD]
[TD="width: 71, bgcolor: transparent"]FM[/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 89, bgcolor: transparent"]350549[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,32[/TD]
[TD="width: 71, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 89, bgcolor: transparent"]350550[/TD]
[TD="width: 217, bgcolor: transparent"]BELT, BLACK, SAM BROWN,34[/TD]
[TD="width: 71, bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]

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
 
Upvote 0
Hi & welcome to MrExcel.
Why not just use the Autofilter function found on the Data tab and filter for non blanks?
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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