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

I have a macro that works great but I want to tweak it a little. In
the macro below the Else value = NULL. Instead of a null result I want
to hide the entire row (or if a Null result then hide row). What do I
need to do?

Sub Process_CheckBox(pObject)

Dim LRow As Integer
Dim LRange As String

'Find row that checkbox resides in
LRow = pObject.TopLeftCell.Row
LRange = "B" & CStr(LRow)

'Change date in column B, if checkbox is checked
If pObject.Value = True Then
ActiveSheet.Range(LRange).Value = "=R2C1"

'Clear date in column B, if checkbox is unchecked AND HIDE ROW
Else
ActiveSheet.Range(LRange).Value = Null

End If

End Sub



Thanks!
Kris

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Change macro to hide row if null

On Feb 7, 1:23 pm, Dave Peterson wrote:
Use a line like:
ActiveSheet.Range(LRange).entirerow.hidden = true
instead of (or along with) that "= null" line.

You may want to add:
ActiveSheet.Range(LRange).entirerow.hidden = false
to the then portion of that statement, too.





wrote:

I have a macro that works great but I want to tweak it a little. In
the macro below the Else value = NULL. Instead of a null result I want
to hide the entire row (or if a Null result then hide row). What do I
need to do?


Sub Process_CheckBox(pObject)


Dim LRow As Integer
Dim LRange As String


'Find row that checkbox resides in
LRow = pObject.TopLeftCell.Row
LRange = "B" & CStr(LRow)


'Change date in column B, if checkbox is checked
If pObject.Value = True Then
ActiveSheet.Range(LRange).Value = "=R2C1"


'Clear date in column B, if checkbox is unchecked AND HIDE ROW
Else
ActiveSheet.Range(LRange).Value = Null


End If


End Sub


Thanks!
Kris


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Works like a charm! THANKS!!!

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
Font color change if cell if null asljwgirl Excel Discussion (Misc queries) 2 August 26th 09 03:43 PM
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
How do you change a NULL value to a Zero when using =MID function? Derek Excel Discussion (Misc queries) 6 July 28th 06 12:09 AM
Handling a Null Cell in Macro Ken Excel Programming 1 October 20th 04 01:51 AM
Handling Null Field in Macro Loop Ken Excel Programming 2 October 19th 04 10:17 PM


All times are GMT +1. The time now is 01:50 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"