View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Celtic_Avenger[_45_] Celtic_Avenger[_45_] is offline
external usenet poster
 
Posts: 1
Default Why Wont This Work? VBA Help Needed!


Why Does This Not Work Properly?

The Sub CommandButton2_Click() code ensures that specific data has bee
entered before allowing the user to continue,
If not the Sub Exits, If they have entered the needed data then I wan
to run the
SaveLock Sub.
However it will work up to the copy sheet to a new workbook part bu
then stops.
Why?

Should I put something different to

Call Savelock at the Else part of the first code?




Private Sub CommandButton2_Click()
Dim rng As Range

Set rng = Range("E6,E16")

If Application.CountA(rng) < 2 Then
MsgBox "Please Complete At Least The Following" & Chr(13) & Chr(13)
"Last Collection Call Date." & Chr(13) & "Lockout Prepared By."
vbInformation, "IMPORTANT!"
Exit Sub

Else
Call SaveLock

End If

End Sub




Private Sub SaveLock()
Dim LockOut

LockOut = MsgBox("Are You Sure You Wish To Create Your Lockout Reques
At This Time?", vbYesNo, "DAILY DRAT")
If LockOut = vbNo Then End

Sheets("Lockout").Select
Sheets("Lockout").Copy
ActiveWindow.DisplayHeadings = False

Dim fn As Variant
fn
Application.GetSaveAsFilename(InitialFileName:=Wor ksheets("Lockout").Range("J2").Value
FileFilter:="Excel Files (*.xls), *.xls", _
Title:="Save This Lockout Request Into Your Lockouts Folder! Do No
Change The File Name Shown!")
If TypeName(fn) = "Boolean" Then
ActiveWorkbook.Close SaveChanges:=False
Sheets("Lock6").Select
MsgBox "Your Lockout Request WAS NOT Saved", vbOKOnly, "SAV
CANCELLED!"
Exit Sub
End If
ActiveWorkbook.SaveAs fn
ActiveWorkbook.Close SaveChanges:=False
ActiveWorkbook.Sheets("Dispatch").Select
MsgBox "Your Lockout Request Has Been Saved And Closed." & Chr(13)
"Please Email To Your District Manager For Processing!"
End Sub


I hope someone can help me with this.

Thanks

Celtic_Avenger
:confused

--
Celtic_Avenge
-----------------------------------------------------------------------
Celtic_Avenger's Profile: http://www.excelforum.com/member.php...fo&userid=1410
View this thread: http://www.excelforum.com/showthread.php?threadid=26138