Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default if cell empty hide row macro?

Hi, I need a macro that will hide rows if a cell in column AD is empty.

Can anyone help me?


Thanks

Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default if cell empty hide row macro?

Range("AD:AD").SpecialCells(xlBlanks).Entirerow.Hi dden = True

--
Regards,
Tom Ogilvy

"Todd" wrote in message
...
Hi, I need a macro that will hide rows if a cell in column AD is empty.

Can anyone help me?


Thanks

Todd



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default if cell empty hide row macro?

You would need a toggle button for that.

If you want to have the command button toggle the rows (each time it is
clicked), you can do

Private Sub CommandButton1_Click()
Dim rng As Range, rng1 As Range
On Error Resume Next
Set rng = Range("AD:AD").SpecialCells(xlBlanks)
Set rng1 = Range("AD:AD").SpecialCells(xlVisible)
On Error GoTo 0
Debug.Print rng.Address
Debug.Print rng1.Address
If Not rng Is Nothing Then
If rng1.Areas.Count = 1 Then
rng.EntireRow.Hidden = True
Else
rng.EntireRow.Hidden = False
End If
End If
End Sub

--
Regards,
Tom Ogilvy


"Todd" wrote in message
...
Thank you Tom, I have this set to a command button and it works

wonderfully. Another question about this though. I want to have the button
hide when clicked and unhide if unselected too. How can somethng like this
be done?

Again, Thanks

Todd





"Tom Ogilvy" wrote:

Range("AD:AD").SpecialCells(xlBlanks).Entirerow.Hi dden = True

--
Regards,
Tom Ogilvy

"Todd" wrote in message
...
Hi, I need a macro that will hide rows if a cell in column AD is

empty.

Can anyone help me?


Thanks

Todd






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on Macro to hide empty rows nLeBlanc21 Excel Discussion (Misc queries) 4 January 19th 10 10:04 PM
Hide the line when cell B is empty Christine Excel Discussion (Misc queries) 4 August 1st 08 05:25 PM
Getting a macro to see the next available empty cell Mark 688 Excel Discussion (Misc queries) 1 September 9th 05 04:19 PM
macro to look for empty cell esrei Excel Discussion (Misc queries) 1 April 14th 05 11:57 AM
Macro to hide rows with empty cells tp58tp Excel Worksheet Functions 2 November 13th 04 02:01 PM


All times are GMT +1. The time now is 01:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"