tNaim.Text, "")
SA (4) = InStr (txtNaim.Text, "?")
SA (5) = InStr (txtNaim.Text, "*")
SA (6) = InStr (txtNaim.Text, "[")
SA (7) = InStr (txtNaim.Text, "]")
n = Len (txtNaim.Text)
For i = 1 To 7
If SA (i)> 0 Or n> 31 Then
MsgBox "Ім'я повинно бути не більше 31 знака." & Chr (13) & "І не містити символів:/? * [] ", VbCritical," Помилка! "p> Exit Sub
End If
Next i
If txtNaim.Text = "" Then
MsgBox "Найменування не може бути порожнім!", vbCritical, "Помилка"
Worksheets ("1"). Activate
Exit Sub
End If
For Each Sheet In ActiveWorkbook.Sheets
If Sheet.Name = txtNaim.Text Then
MsgBox "Сторінка з такою назвою вже існує!", vbCritical, "Помилка"
Exit Sub
End If
Next Sheet
Workbooks ("Firms"). Unprotect Password: = "Firms1"
Workbooks ("Firms"). Activate
Sheets.Add.Move after: = Worksheets (Worksheets.Count)
Range ("A1: E1"). Select
Selection.HorizontalAlignment = xlCenter
Selection.VerticalAlignment = xlBottom
Selection.NumberFormat = "General"
With Selection.Font
. Name = "Arial"
. FontStyle = "напівжирний"
. Size = 8
. Strikethrough = False
. Superscript = False
. Subscript = False
. OutlineFont = False
. Shadow = False
. Underline = xlUnderlineStyleNone
. ColorIndex = xlAutomatic
End With
Selection.Borders (xlDiagonalDown). LineStyle = xlNone
Selection.Borders (xlDiagonalUp). LineStyle = xlNone
With Selection.Borders (xlEdgeLeft)
. LineStyle = xlContinuous
. Weight = xlThin
. ColorIndex = xlAutomatic
End With
With Selection.Borders (xlEdgeTop)
. LineStyle = xlContinuous
. Weight = xlThin
. ColorIndex = xlAutomatic
End With
With Selection.Borders (xlEdgeBottom)
. LineStyle = xlContinuous
. Weight = xlThin
. ColorIndex = xlAutomatic
End With
With Selection.Borders (xlEdgeRight)
. LineStyle = xlContinuous
. Weight = xlThin
. ColorIndex = xlAutomatic
End With
With Selection.Borders (xlInsideVertical)
. LineStyle = xlContinuous
. Weight = xlThin
. ColorIndex = xlAutomatic
End With
With Selection.Interior
. ColorIndex = 39
. Pattern = xlSolid
. PatternColorIndex = xlAutomatic
End With
Range ("A1"). Value = txtNaim.Text
Range ("B1"). Value = txtAdr.Text
Range ("C1"). Value = txtTel1.Text
Range ("D1"). Value = txtTel2.Text
Range ("E1"). Value = txtSite.Text
Range ("A1: E1"). Select
With Selection
. HorizontalAlignment = xlCenter
. VerticalAlignment = xlCenter
. W...