My Rows won't hide

  • Thread starter Thread starter Taylor Francis
  • Start date Start date
T

Taylor Francis

This is my function...

Function GetNameForSummary(x, y)
If (Len(x) > 2) Then
Worksheets(1).Rows(y).Hidden = False
Else
Worksheets(1).Rows(y).Hidden = True
End If
GetNameForSummary = x
End Function


The function is called like this:
=GetNameForSummary(a1,row())

the desired function is if a1 is longer than 2character, show it in the
new cell (where the call is), if not, then hide the row that contains
this function call...

It won't hide the row...why?

Taylor
 
Taylor,

A function called from a worksheet cell cannot change the Excel
environment in any way, including hiding rows. It can only return
a value back to the cell from which it was called.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top