Solved

Excel: Macro to Hide Rows Based on Column Value

Posted on 2014-09-24
2
623 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

756 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