lwagner00
01-16-2009, 01:40 PM
I have this formula but cannot make the exit sub function work when I insert this command. I want the box to close when okay is selected to eliminate the possibility of duplicate entries
HELP
Private Sub Okay_Click()
Columns("A:E").Select
ActiveSheet.Unprotect
Range("B2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = Ministry.Value
ActiveCell.Offset(0, 1) = FiscalYear.Value
ActiveCell.Offset(0, 2) = TypeOfDoc.Value
ActiveCell.Offset(0, 3) = DocPpdBy.Value
ActiveCell.Offset(0, 4) = EnteredBy.Value
Columns("A:E").Select
ActiveSheet.Unprotect
ActiveSheet.Calculate
With Worksheets("entry")
If Not .AutoFilterMode Then
.Range("A1").AutoFilter
End If
.EnableAutoFilter = True
.Protect , _
Contents:=True, UserInterfaceOnly:=True
End With
'ActiveSheet.Protect
End Sub
HELP
Private Sub Okay_Click()
Columns("A:E").Select
ActiveSheet.Unprotect
Range("B2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = Ministry.Value
ActiveCell.Offset(0, 1) = FiscalYear.Value
ActiveCell.Offset(0, 2) = TypeOfDoc.Value
ActiveCell.Offset(0, 3) = DocPpdBy.Value
ActiveCell.Offset(0, 4) = EnteredBy.Value
Columns("A:E").Select
ActiveSheet.Unprotect
ActiveSheet.Calculate
With Worksheets("entry")
If Not .AutoFilterMode Then
.Range("A1").AutoFilter
End If
.EnableAutoFilter = True
.Protect , _
Contents:=True, UserInterfaceOnly:=True
End With
'ActiveSheet.Protect
End Sub