My Rows won't hide

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
 
C

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top