Никак не могу вставить данный код
Код |
---|
txt_Дата_3 = Format(Date, "dd.mm.yyyy" |
в мой макрос, чтоб он автоматически выполнялся в TextBox (txt_Дата_3,txt_Дата_5,txt_Дата_7,txt_Дата_9).
Куда можно данный код вставить в макрос:
Код |
---|
Sub vsii_1(s)
Dim LastRow As Long
Dim SummaStrok As Double
Dim i As Long
LastRow = Worksheets("ФІЛІЯ ВАСИЛЬ І ПЕТРО").Cells(Rows.Count, 1).End(xlUp).Row
With UserForm_1
If s = "СУМА" Then
.TextBox2 = Application.Sum([B:B])
For i = 4 To LastRow
If CDate(Cells(i, 1).Value) >= CDate(.txt_Дата_2) And CDate(Cells(i, 1).Value) <= CDate(.txt_Дата_3) Then
SummaStrok = SummaStrok + CDbl(Cells(i, 2).Value)
End If
Next i
.txt_Дата_3 = Format(Date, "dd.mm.yyyy")
.TextBox2 = SummaStrok: SummaStrok = 0
Else
For i = 4 To LastRow
If CDate(Cells(i, 1).Value) >= CDate(.txt_Дата_2) And CDate(Cells(i, 1).Value) <= CDate(.txt_Дата_3) Then
SummaStrok = SummaStrok + CDbl(Cells(i, 2).Value)
End If
Next i
End If
If UserForm_1.TextBox2.Value >= 0 Then
If UserForm_1.TextBox2.Value >= 0 Then UserForm_1.TextBox4.Value = Val(UserForm_1.TextBox2.Value) - Val(UserForm_1.TextBox3.Value)
End If
End With
End Sub |
Спасибо заранее.