VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} MDK 
   Caption         =   "Введите данные"
   ClientHeight    =   1950
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3330
   OleObjectBlob   =   "MDK.frx":0000
   StartUpPosition =   1  'ПоЦентруВладельца
End
Attribute VB_Name = "MDK"
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False



Public row As Integer, col As Integer

Private Sub CommandButton2_Click()
Dim lnColumn As Integer, lnRow As Integer, LookRange As Excel.Range, formCol, formRow, formRowCount
    If MDK.TextBox1.Text = "" Or MDK.TextBox2.Text = "" Or (Sheets("Service").Range("A18") = 0 And MDK.TextBox2.Text = "") Then Exit Sub
    ' Удалим старый алгоритм
    With Sheets("Service")
        formCol = .Range("KRIT_FORM").Column
        formRow = .Range("KRIT_FORM").row
        'formRowCount = .Range("TAB_FORM").Columns.count
        .Cells(formRow + 1, formCol) = .Range("A16")
        .Cells(formRow + 1, formCol + 1) = .Range("A17")
        lnColumn = Sheets("Service").Range("TAB_FORM").Column
        If .Cells(formRow + 2, formCol + 1) = 0 Then 'запись есть
            lnRow = .Cells(formRow + 7, formCol)
        Else
            ' Необходимо добавить новую запись в TAB_FORM
            Set LookRange = Sheets("Service").Columns(lnColumn).Find("", LookIn:=xlFormulas, lookat:=xlWhole, SearchOrder:=xlByRows)
            lnRow = LookRange.row
        End If
    End With
    Sheets("Service").Cells(lnRow, lnColumn) = Sheets("Service").Range("A16").Text
    Sheets("Service").Cells(lnRow, lnColumn + 1) = Sheets("Service").Range("A17").Text
    Sheets("Service").Cells(lnRow, lnColumn + 2) = MDK.TextBox1.Tag
    Sheets("Service").Cells(lnRow, lnColumn + 3) = MDK.TextBox2.Tag
    Sheets("Service").Cells(lnRow, lnColumn + 4) = MDK.TextBox3.Tag
    Sheets("Service").Cells(lnRow, lnColumn + 5) = MDK.TextBox3.Text
    Sheets("Service").Cells(lnRow, lnColumn + 6).FormulaLocal = "=СТРОКА()"
    Sheets("Service").Cells(lnRow, lnColumn + 7) = MDK.TextBox1.Text
    Unload Me
End Sub

Private Sub CommandButton3_Click()
    Unload Me
End Sub

Private Sub CommandButton5_Click()
    With SEEK_POP
        load SEEK_POP
        .lbMulti = lbMulti
        .lnWhatLoad = 3
        .Form_Init_New ""
        .Show
        TextBox1.Text = SEEK_POP.pcRetValue
        TextBox1.Tag = SEEK_POP.pcRetLink
        TextBox2.Text = ""
        TextBox3.Text = ""
        Unload SEEK_POP
    End With
End Sub

Private Sub CommandButton6_Click()
If TextBox1.Text <> "" Then
    With SEEK_POP
        load SEEK_POP
        .lbMulti = lbMulti
        .lnWhatLoad = 2
        .Form_Init_New TextBox1.Text
        .Show
        TextBox2.Text = SEEK_POP.pcRetLink
        TextBox2.Tag = SEEK_POP.pcRetLink
        Unload SEEK_POP
    End With
End If
End Sub

Private Sub CommandButton7_Click()
If TextBox1.Text <> "" Then
    With SEEK_POP
        load SEEK_POP
        .lbMulti = lbMulti
        .lnWhatLoad = 1
        .Form_Init_New TextBox1.Text
        .Show
        TextBox3.Text = SEEK_POP.pcRetValue
        TextBox3.Tag = SEEK_POP.pcRetLink
        Unload SEEK_POP
    End With
End If
End Sub

Private Sub UserForm_Click()

End Sub

Private Sub CommandButton4_Click()
Dim lnColumn As Integer, lnRow As Integer, LookRange As Excel.Range, formCol, formRow, formRowCount
    ' Удалим старый алгоритм
    With Sheets("Service")
        formCol = .Range("KRIT_FORM").Column
        formRow = .Range("KRIT_FORM").row
        'formRowCount = .Range("TAB_FORM").Columns.count
        .Cells(formRow + 1, formCol) = .Range("A16")
        .Cells(formRow + 1, formCol + 1) = .Range("A17")
        If .Cells(formRow + 2, formCol + 1) = 0 Then 'запись есть
            lnRow = .Cells(formRow + 7, formCol)
            lnColumn = .Range("TAB_FORM").Column
            formRowCount = .Range("TAB_FORM").Columns.count
            .Range(.Cells(lnRow, lnColumn), .Cells(lnRow, lnColumn + formRowCount - 1)).Delete Shift:=xlUp
        End If
    End With
    MDK.TextBox1.Text = ""
    MDK.TextBox1.Tag = 0
    MDK.TextBox2.Text = ""
    MDK.TextBox2.Tag = 0
    MDK.TextBox3.Text = ""
    MDK.TextBox3.Tag = 0
End Sub

