Option Explicit
Dim myrng As Range
Dim shp As Shape
Sub displayData()
Set shp = ThisWorkbook.Sheets(1).Shapes(Application.Caller)
Select Case shp.TextFrame.Characters.Text
Case "Display Data Hiding Zero"
shp.TextFrame.Characters.Text = "Display all Data"
For Each myrng In Range("D2:D23")
If myrng = 0 Then myrng.EntireRow.Hidden = True
Next
Case Else
shp.TextFrame.Characters.Text = "Display Data Hiding Zero"
Cells.EntireRow.Hidden = False
End Select
End Sub
Dim myrng As Range
Dim shp As Shape
Sub displayData()
Set shp = ThisWorkbook.Sheets(1).Shapes(Application.Caller)
Select Case shp.TextFrame.Characters.Text
Case "Display Data Hiding Zero"
shp.TextFrame.Characters.Text = "Display all Data"
For Each myrng In Range("D2:D23")
If myrng = 0 Then myrng.EntireRow.Hidden = True
Next
Case Else
shp.TextFrame.Characters.Text = "Display Data Hiding Zero"
Cells.EntireRow.Hidden = False
End Select
End Sub
For details about Application.Caller plz refer:
Example file link
https://docs.google.com/file/d/0B23eJ2xd9ODyZXNHNktaeWlFUkU/edit?usp=sharing
No comments:
Post a Comment