View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Clarification please...

You have already received the explanation vis-a-vis the If part. An
additional tidbit is that the If is totally unnecessary.

Cancel = ThisWorkbook.Sheets("Sheet1").Range("A1").Value < True

or

Cancel = Not ThisWorkbook.Sheets("Sheet1").Range("A1").Value

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article <nEric.16454$VQ3.11320@lakeread06, says...
I thought there was this rule where if you use the "If" keyword
somewhere afterwards one had to follow-up with the "End If" phrase.
Obviously not. Maybe the rule only applies in a Standard module
and not a class module like below. Can someone clarify?
Thanks in advance..


Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ThisWorkbook.Sheets("Sheet1").Range("A1").Value < True _
Then Cancel = True
End Sub