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

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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
 
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,214,405
Messages
6,119,320
Members
448,887
Latest member
AirOliver

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