Private Sub Worksheet_selectionChange(ByVal Target As Range)
Dim myrange As Range
If Not Intersect(Target, Range("f6")) Is Nothing Then Exit Sub
Set myrange = Union(Cells(8, 4), Cells(9, 4), Cells(10, 4))
If [f6] <> "" And Range("f6:g6").MergeCells = True Then
Cells(8, 4) = 1
Cells(9, 4) = 2
Cells(10, 4) = 3
Exit Sub
Else
myrange = ""
End If
End Sub
اكتب هذا الكود
جربه أولاً في صفحة مستقلة لنعرف النتيجة