I'd like to merge two Private Worksheets_Change in VBA. Is any solution of this problem?
Thank you for answer
David
First code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
For i = 2 To 100
If Cells(i, "D").Value <> "" And Cells(i, "B").Value = "" Then
Cells(i, "B").Value = Date
Cells(i, "B").NumberFormat = "dd.mm.yyyy"
End If
Next
Range("B:B").EntireColumn.AutoFit
End Sub
Second code
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim xRow As Long
xRow = 2
ThisWorkbook.ActiveSheet.Unprotect Password:="123456"
ThisWorkbook.ActiveSheet.Cells.Locked = False
Do Until IsEmpty(Cells(xRow, 1))
If Cells(xRow, 1) < Date Then
Rows(xRow).Locked = True
End If
xRow = xRow + 1
Loop
ThisWorkbook.ActiveSheet.Protect Password:="123456"
End Sub
Bookmarks