![]() |
Auto Open Not Functioning
Hi,
I have the following routine running with AutoOpen, but it is just not working - it was fine until I included the IF statement at the beginning. Help appreciated! Sub AutoOpen() If LCase(ThisWorkbook.Name) = "readyreckoner.xls" Then Sheets("READY RECKONER").Visible = True Sheets("READY RECKONER").Select Sheets("READY RECKONER").Protect DrawingObjects:=False, Contents:=False, Scenarios:=False Range("CONTRACT_LENGTH").Select Selection.ClearContents Range("NO_OF_TEMPS").Select Selection.ClearContents Range("DAILY_HOURS").Select Selection.ClearContents Range("PAY_RATE").Select Selection.ClearContents Range("ENTER_MARGIN").Select Selection.ClearContents Range("ENTER_MARKUP").Select Selection.ClearContents Range("ENTER_FIXED").Select Selection.ClearContents Sheets("READY RECKONER").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Sheets("READY RECKONER").Visible = False Sheets("ROLLING PENNY").Visible = True Sheets("ROLLING PENNY").Select Sheets("READY RECKONER").Protect DrawingObjects:=False, Contents:=False, Scenarios:=False Range("Q12").Select ActiveCell.FormulaR1C1 = "1" Range("S12").Select ActiveCell.FormulaR1C1 = "1" Range("A1").Select Sheets("READY RECKONER").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Sheets("ROLLING PENNY").Visible = False End If ' display user input form ReadyReckoner.Show End Sub |
Auto Open Not Functioning
ThisWorkbook refers to the workbook that the macro is in. If your
'ReadyReckoner' is in another workbook, it will fail. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Graham" wrote in message ... Hi, I have the following routine running with AutoOpen, but it is just not working - it was fine until I included the IF statement at the beginning. Help appreciated! Sub AutoOpen() If LCase(ThisWorkbook.Name) = "readyreckoner.xls" Then Sheets("READY RECKONER").Visible = True Sheets("READY RECKONER").Select Sheets("READY RECKONER").Protect DrawingObjects:=False, Contents:=False, Scenarios:=False Range("CONTRACT_LENGTH").Select Selection.ClearContents Range("NO_OF_TEMPS").Select Selection.ClearContents Range("DAILY_HOURS").Select Selection.ClearContents Range("PAY_RATE").Select Selection.ClearContents Range("ENTER_MARGIN").Select Selection.ClearContents Range("ENTER_MARKUP").Select Selection.ClearContents Range("ENTER_FIXED").Select Selection.ClearContents Sheets("READY RECKONER").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Sheets("READY RECKONER").Visible = False Sheets("ROLLING PENNY").Visible = True Sheets("ROLLING PENNY").Select Sheets("READY RECKONER").Protect DrawingObjects:=False, Contents:=False, Scenarios:=False Range("Q12").Select ActiveCell.FormulaR1C1 = "1" Range("S12").Select ActiveCell.FormulaR1C1 = "1" Range("A1").Select Sheets("READY RECKONER").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Sheets("ROLLING PENNY").Visible = False End If ' display user input form ReadyReckoner.Show End Sub |
All times are GMT +1. The time now is 05:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com