Thread: If Then
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default If Then

When I retrieved the headers in this newsgroup, Tom's response wasn't there yet.



Dean wrote:

Wow, what a response!

Dave, I'm not sure what your point was, seemingly praising Tom's approach
but still offering a slightly different macro. How is yours different from
Tom's? Are you just pointing out that it is case sensitive, so the lcase (I
assume that's lower case) is safer?

In any event, I thank everyone, as it looks like any of these will do the
trick.

Dean

"Dave Peterson" wrote in message
...
Sometimes using the "select case" syntax makes things easier to see.

Option Explicit
Sub testme()
With ActiveSheet
Select Case LCase(.Name)
Case Is = "sheet1", "sheet2", "sheet3"
.Rows(16).Hidden = True
Case Is = "sheet4"
.Rows(4).Hidden = True
Case Else
'do nothing
End Select
End With
End Sub

ps. this is a text only newsgroup--please post in plain text (not HTML
and no
attachments).

Dean wrote:

Can someone give me the exact code for the following general situation:

If the active worksheet when a macro is called is sheet 1 or sheet2 or
sheet3,
then hide row 16. Or, if sheet 4, hide row 18. If any other sheet,
don't
hide anything - that I suppose requires no text!

Thanks!
Dean


--

Dave Peterson


--

Dave Peterson