Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel: Macro to Hide Rows Based on Column Value

Posted on 2014-09-24
2
Medium Priority
?
705 Views
Last Modified: 2014-09-25
Hello,

Seeking help to code a macro that when activated will

1. Hide rows 10-29 if a value in column AB says 'Hide'

E.g if AB10 says 'Hide' - then row 10.

2. Print the sheet

3. Unhide rows 10-29 (regardless of the AB column values).

What's the best way of doing this?

Cheers.
0
Comment
Question by:dabug80
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 2000 total points
ID: 40343397
Sub HidenThenPrint()
For introw = 10 To 29
    If Cells(introw, 28) = "Hide" Then
        Rows(introw).Hidden = True
    End If
Next
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Rows("10:29").EntireRow.Hidden = False
End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:dabug80
ID: 40345173
Great. Thanks for your help
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question