Select just blank row in a range and reduce the size

DPARDY

New Member
Joined
Dec 3, 2009
Messages
41
Office Version
  1. 365
Platform
  1. Windows
The range is A1 to H150 of data, I want to just select the blank rows with vba and reduce the size to avoid printing 6 pages and only printing 4.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
VBA Code:
Sub DPARDY()
For i = 1 To 150 'Rows 1:150
    For j = 1 To 8 'Columns A:H
        myStr = myStr & Cells(i, j).Value
    Next j
    If myStr = "" Then Rows(i).EntireRow.Hidden = True
    myStr = ""
Next i
End Sub
 
Upvote 0
Solution
VBA Code:
Sub DPARDY()
For i = 1 To 150 'Rows 1:150
    For j = 1 To 8 'Columns A:H
        myStr = myStr & Cells(i, j).Value
    Next j
    If myStr = "" Then Rows(i).EntireRow.Hidden = True
    myStr = ""
Next i
End Sub
PERFECT, thank you again.
 
Upvote 0
In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

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