Thread: If Then
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 430
Default If Then

Dean I concocked this; test it out completely.. (it worked for me)..

Sub test()
Dim arr As Variant
Dim arr1 As Variant
Dim arrcount As Integer
arr = Array("Sheet1", "Sheet2", "Sheet3")
arr1 = "Sheet4"
arrcount = UBound(arr)
For i = 1 To arrcount
If arr(i) = ActiveSheet.Name Then
Range("A16").EntireRow.Hidden = True
End If
Next i
If arr1 = ActiveSheet.Name Then
Range("A18").EntireRow.Hidden = True
End If
End Sub

HTH
Jim May


"Dean" wrote in message
:

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