Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() hi.... im working on a project right now and one of its functions is to ad persons on the worksheet....my problem is, how can i stop excel fro adding the person i input if i press Close or No button?...because wha is happening now is that, even if i press the close or no button, still that record is added on the worksheet, below is the source code, pleas advise: Sub Button5_Click() Dim i As Integer Dim results As Integer results = MsgBox("Are you sure you want to add new employee?" vbQuestion, "Add New Employee") If results = vbOK Then i = 4 Do While Worksheets("EmployeeDatabase").Range("A" & i) < "" i = i + 1 Loop Worksheets("EmployeeDatabase").Unprotect Worksheets("EmployeeDatabase").Range("A" & i) Worksheets("AddNew").Range("G12") Worksheets("EmployeeDatabase").Range("B" & i) Worksheets("AddNew").Range("G16") Worksheets("EmployeeDatabase").Range("C" & i) Worksheets("AddNew").Range("G14") Worksheets("EmployeeDatabase").Range("D" & i) Worksheets("AddNew").Range("G15") Worksheets("EmployeeDatabase").Range("E" & i) Worksheets("AddNew").Range("G13") Worksheets("EmployeeDatabase").Range("F" & i) Worksheets("AddNew").Range("G17") Sheets("AddNew").Select Range("G13:G16").Select Selection.ClearContents Range("G13").Select End If Worksheets("EmployeeDatabase").Protect End Su -- tweety12 ----------------------------------------------------------------------- tweety127's Profile: http://www.excelforum.com/member.php...fo&userid=3467 View this thread: http://www.excelforum.com/showthread.php?threadid=55139 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find&press button | New Users to Excel | |||
excel close + save by button press. how? | Excel Programming | |||
press button via vb and excel | Excel Programming | |||
key Press on Forms Button | Excel Programming | |||
Proteting against a button press | Excel Programming |