LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default invalid use of property message

Looks like it's missing the closing End If that should be right before End Sub.


"Larry Fitch" wrote:


Hi Barb -

Thanks very much for the reply.. When I use this code I get an error "Block
If without End If"
--
Thanks

Larry


"Barb Reinhardt" wrote:

Sub Test1()
Dim myWS As Excel.Worksheet
Dim myWB As Excel.Workbook

Set myWB = ThisWorkbook

If myWS.Name = "Pay Inflation - Biometrics" Or _
myWS.Name = "Statistics" Or _
myWS.Name = "Direct Cost Savings Breakdown" Or _
myWS.Name = "OT Reduction" Or _
myWS.Name = "Nurse OT Reduction" Or _
myWS.Name = "Premium Labor Utilization" Or _
myWS.Name = "Pay inflation - Timestamp" Or _
myWS.Name = "Calculation Error" Or _
myWS.Name = "Leave Inflation" Or _
myWS.Name = "Absenteeism" Or _
myWS.Name = "Walk Time Reductions" Or _
myWS.Name = "Paper Costs" Or _
myWS.Name = "Direct Cost Savings" Or _
myWS.Name = "Financial Analysis" Or _
myWS.Name = "Project Timeline Savings " Or _
myWS.Name = "Total Cost of Ownership" Then
With myWS
If .Visible < xlSheetVisible Then
.Visible = Not .Visible
'You actually can have xlSheetHidden or
'xlSheetVeryHidden here.

End If
End With
End Sub


Try this. Keep in mind that you have to have one worksheet visible in the
workbook.
--
HTH,

Barb Reinhardt



"Larry Fitch" wrote:

I am trying to cre4ate a macro that checks the value of a number of sheets to
determine if they are already visible and if so it will not close them -

With Sheets("Pay Inflation - Biometrics")
Sheets ("Statistics")
Sheets ("Direct Cost Savings Breakdown")
Sheets ("OT Reduction")
Sheets ("Nurse OT Reduction")
Sheets ("Premium Labor Utilization")
Sheets ("Pay inflation - Timestamp")
Sheets ("Calculation Error")
Sheets ("Leave Inflation")
Sheets ("Absenteeism")
Sheets ("Walk Time Reductions")
Sheets ("Paper Costs")
Sheets ("Direct Cost Savings")
Sheets ("Financial Analysis")
Sheets ("Project Timeline Savings ")
Sheets ("Total Cost of Ownership")
If .Visible < xlSheetVisible Then
.Visible = Not .Visible
End If
End With

When I run the macro I get the "invalid use of property" message.. Can some
one tell me what I am doing wrong ??


--
Thanks

Larry



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Invalid use of Property" message Larry Fitch Excel Programming 0 March 28th 10 06:27 PM
Runtime error 380 - Could not set the list property. Invalid property value. [email protected] Excel Programming 3 February 27th 07 06:35 AM
Clear Form results in INCORRECT "Invalid Property" message.... B[_4_] Excel Programming 3 April 20th 06 06:24 PM
Runtime Error 380 – Could not set the list property. Invalid property value BernzG[_16_] Excel Programming 2 August 21st 05 10:10 PM
Runtime error 380: Could not set the List property. invalid property value of listbox jasgrand Excel Programming 0 October 6th 04 09:28 PM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"