Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 24th, 2004, 08:53 AM
Registered User
Join Date: Nov 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hide Row with VBA


I'm wondering if there is a function in VBA Excel to hide row or unhide rows.

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old November 24th, 2004, 09:08 AM
Authorized User
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts

Yes: set the Hidden property of the required Range object to True, eg:

to hide the 5th row in the current worksheet
Reply With Quote
  #3 (permalink)  
Old November 24th, 2004, 09:11 AM
Authorized User
Join Date: Oct 2004
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered

Selection.EntireRow.Hidden = True

will hide the rows and

Selection.EntireRow.Hidden = False

will display them..

simple routine to use them could be..

Sub Hide()
RowShow 4, 4, True
End Sub

Sub Show()
RowShow 4, 4, False
End Sub

Sub RowShow(myRow1 As Double, myRow2 As Double, bStatus As Boolean)
If bStatus = True Then bStatus = False Else bStatus = True
Rows(myRow1 & ":" & myRow2).Select
Selection.EntireRow.Hidden = bStatus
End Sub

Where myRow1 and myRow2 are the row numbers, so if you want to hide a single you (ie 4) you enter the same number twice (4,4), or you enter the start and end point for a number of rows (ie 5 to 10)

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide a Row in a FormView Control frosty ASP.NET 2.0 Basics 5 July 14th, 2006 03:07 PM
show/hide row(s) eugz Beginning PHP 0 March 19th, 2006 10:10 PM
How to hide VBA code james gold Excel VBA 12 November 14th, 2005 10:59 AM
Hide table with VBA mmcdonal Access VBA 5 June 24th, 2005 10:13 AM
Hide VBA code when forwarding macro sh333384 Excel VBA 7 September 2nd, 2004 10:23 AM

All times are GMT -4. The time now is 03:34 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.