Re: If then else

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Here is the updated code to "re-lock" the fields when the file is
closing. If you dont want a password, but want the sheets still
locked, then you can just leave off the "password" portion
(WSN.Protect) (Unprotect), and it will lock the book without a
password. I also added a line to the end to force the book to be saved
so they dont have the option of closing out without saving. If you want
to re-instate that option, just remove that line from the code.

Dim r As Variant
Dim WSN As Variant
Set WSN = ThisWorkbook.Sheets("TimeCard")
r = 9
Do Until WSN.Cells(r, 10).Value = ""
If WSN.Cells(r, 10).Value = "Tardy" And WSN.Cells(r, 11).Value = ""
Then
MsgBox "Please enter the amount of time tardy"
Cancel = True
Exit Do
Exit Sub
Else:
r = r + 1
End If
Loop
WSN.Protect "same password"
thisworkbook.close (true)


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=10581
View this thread: http://www.excelforum.com/showthread.php?threadid=513772

.



Relevant Pages

  • PotM Re: A Typology of Scientism
    ... i dont want names of people who agree with you. ... If the work is written in meter, does the variant scan? ... does the word fit in the ... Neither is particularly favored by the author or character elsewhere. ...
    (talk.origins)
  • Re: A Typology of Scientism
    ... i dont want names of people who agree with you. ... If the work is written in meter, does the variant scan? ... does the word fit in the ... Neither is particularly favored by the author or character elsewhere. ...
    (talk.origins)
  • [PATCH] percpu_counter : add percpu_counter_add_fast()
    ... I based following patch against linux-2.6, I dont know if previous ... Christoph patch is in a git tree. ... Users of this percpu_counter variant should not use ... sizeofbytes per possible cpu per counter. ...
    (Linux-Kernel)
  • Re: Closing form Problem
    ... but if the user press the X button on the form ... > closing and I ve try to put a breakpoint in the closing event but the ... > event dont rise when the X button is clicked. ... > Shall i display the forms as .Showdialog and close them on the ...
    (microsoft.public.dotnet.framework.compactframework)
  • Closing form Problem
    ... but if the user press the X button on the form ... closing and I ve try to put a breakpoint in the closing event but the ... event dont rise when the X button is clicked. ... Shall i display the forms as .Showdialog and close them on the ...
    (microsoft.public.dotnet.framework.compactframework)