. . , . . .
.
. .
, , =director, . . , , . . VBA:
:
Private Sub UserForm_Activate() Worksheets.Item("Konst").Activate UserForm1.TextBox1.Text = Range("Director").TextEnd Sub"" ( ):
Private Sub CommandButton2_Click() Range("Director").Value = UserForm1.TextBox1.TextEnd Sub"" :
Private Sub CommandButton1_Click() Unload MeEnd Sub, . .
VBA
. . . , Windows , - . . , 1000 , :-). . -. :-))) .
VBA VB On Error. ( ), . :
Sub Test() On Error GoTo Errors1 Dim x As Integer Dim a As Integer Dim c As Double x = 20 a = 0 c = x / a MsgBox (" ") GoTo Ends:Errors1: MsgBox (" ")Ends:End SubErrors1 . , - . , VBA , Resume Next. - . , .
Sub Test() On Error GoTo Errors1 Dim x As Integer Dim a As Integer Dim c As Double x = 20 a = 0 c = x / a MsgBox ("!!!") GoTo Ends:Errors1: MsgBox (" ") Resume NextEnds:End Sub, , . .
|
|
, :
Resume NextResune Resume Resume 0
Err
, , 13 Err, . , . .
Sub Test() On Error GoTo Error1 Sheets.Item(1000).Delete GoTo EndsError1: MsgBox "Error detected" MsgBox (Str(Err.Number)) MsgBox (Err.Source) MsgBox (Err.Description)Ends:End Sub, Number - Source, , Description . . . . , : .
Err Clear, . . . , .
Sub Test() On Error GoTo Error1 Sheets.Item(1000).Delete GoTo EndsError1: Err.Clear MsgBox "Error detected" MsgBox (Str(Err.Number)) MsgBox (Err.Source) MsgBox (Err.Description)Ends:End Sub, ..
ResumeExit Sub(Function)On ErrorRaise, , 1000 VBA, 65535. , . vbObjectError.
Sub Test() On Error GoTo Error1 Err.Raise 1001, "Test()", " "Error1: MsgBox "Error detected" MsgBox (Str(Err.Number)) MsgBox (Err.Source) MsgBox (Err.Description)Ends:End Sub
- , .
1.
. http://www.firststeps.ru/vba/excel/vbaexcel1.html