.


:




:

































 

 

 

 





. . , . . .

.

. .

, , =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 Sub

Errors1 . , - . , 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

, , . .

Sub Test() On Error Resume Next Dim x As Integer Dim a As Integer Dim c As Double x = 20 a = 0 c = x / a x = 10 a = 3 c = 10 / 3 MsgBox ("!!!")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 Error

Raise, , 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. , .

1.

 

. http://www.firststeps.ru/vba/excel/vbaexcel1.html

 





:


: 2016-09-03; !; : 639 |


:

:

, ,
==> ...

1328 - | 1275 -


© 2015-2024 lektsii.org - -

: 0.012 .