One more option (I like Option Compare Text, though):
If LCase(ThisWorkbook.Name) = "READYRECKONER.xls" Then
to
If LCase(ThisWorkbook.Name) = lcase("READYRECKONER.xls") Then
or even
If StrComp(ThisWorkbook.Name, "readyreckoner.xls", vbTextCompare) = 0 Then
Graham wrote:
Hi,
I have the following code running with Auto Open, but the
procedure does not seem to be working. It looks as if it's
skipping straight to the user form display at the end. I
guess there's something wrong with my "if" statement, but
I don't know what it is. Any help gratefully received!
Thanks
Graham
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 the Ready Reckoner Input Form
ReadyReckoner.Show
--
Dave Peterson