Всем доброго времени суток!
Уважаемые форумчане, подскажите, пожалуйста, дебилу,как объединить 3 подобных макроса(сделанных,естественно,с Вашей помощью) в 1. Заранее спасибо.
Sub enter()
Dim LstR As Long
Dim i As Long
With Sheets("Data")
LstR = .Cells(.Rows.Count, 3).End(xlUp).Row
Application.EnableEvents = False
For i = 3 To LstR
If .Cells(i, 3) = Me.[N4] Then
If .Cells(i, 4) = Me.[B4] Then
.Cells(i, 4).ClearContents
Else
.Cells(i, 4).Value = Me.[B4]
End If
Me.[B4:N4]
Application.EnableEvents = True
Exit Sub
End If
Next
End With
Application.EnableEvents = True
End Sub
Sub enter2()
Dim LstR As Long
Dim i As Long
With Sheets("Data")
LstR = .Cells(.Rows.Count, 3).End(xlUp).Row
Application.EnableEvents = False
For i = 3 To LstR
If .Cells(i, 3) = Me.[N4] Then
If .Cells(i, 10) = Me.[O4] Then
.Cells(i, 10).ClearContents
Else
.Cells(i, 10).Value = Me.[O4]
End If
Me.[N4:O4]
Application.EnableEvents = True
Exit Sub
End If
Next
End With
Application.EnableEvents = True
End Sub
Sub enter3()
Dim LstR As Long
Dim i As Long
With Sheets("Data")
LstR = .Cells(.Rows.Count, 3).End(xlUp).Row
Application.EnableEvents = False
For i = 3 To LstR
If .Cells(i, 3) = Me.[N4] Then
If .Cells(i, 11) = Me.[I1] Then
.Cells(i, 11).ClearContents
Else
.Cells(i, 11).Value = Me.[I1]
End If
Me.[I1:N4]
Application.EnableEvents = True
Exit Sub
End If
Next
End With
Application.EnableEvents = True
End Sub