My syntax not working with Auto Open procedure

  • Thread starter Thread starter Graham
  • Start date Start date
G

Graham

Hi,
I have the following code to run under Auto Open

Sub Auto_Open()

If UCase(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
 
UCase(ThisWorkbook.Name) = "READYRECKONER.xls"
can never evaluate to true as
UCase("READYRECKONER.xls") is "READYRECKONER.XLS"
 
UCase(ThisWorkbook.Name) = "READYRECKONER.xls"

will never be true because xls is lower case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top