Ðề: Bẫy lỗi nhập trùng dữ liệu trong phạm vi cột chỉ định thì hiện hộp thoại thông báo
Bạn thử xài macro sự kiện sau; Nó sẽ triệu gọi macro sau bổ trợ việc tìm trùng cho bạn:
:ngugat:
Mã nguồn PHP:
[COLOR=#000000]
Option Explicit
[/COLOR][COLOR=#007700]Private [/COLOR][COLOR=#0000BB]Sub Worksheet_Change[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]ByVal Target [/COLOR][COLOR=#007700]As [/COLOR][COLOR=#0000BB]Range[/COLOR][COLOR=#007700])
[/COLOR][COLOR=#0000BB]Dim Rng [/COLOR][COLOR=#007700]As [/COLOR][COLOR=#0000BB]Range
[/COLOR][COLOR=#007700]If [/COLOR][COLOR=#0000BB]Not Intersect[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]Target[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]Columns[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"E:E"[/COLOR][COLOR=#007700])) [/COLOR][COLOR=#0000BB]Is Nothing Then
Set Rng [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]Columns[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"E:E"[/COLOR][COLOR=#007700])
[/COLOR][COLOR=#0000BB]GPE Rng[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]Target[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]Value
[/COLOR][COLOR=#007700]ElseIf [/COLOR][COLOR=#0000BB]Not Intersect[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]Target[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]Columns[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"F:O"[/COLOR][COLOR=#007700])) [/COLOR][COLOR=#0000BB]Is Nothing Then
Set Rng [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]Columns[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"f:o"[/COLOR][COLOR=#007700])
[/COLOR][COLOR=#0000BB]GPE Rng[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]Target[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]Value
End [/COLOR][COLOR=#007700]If
[/COLOR][COLOR=#0000BB]End Sub
[/COLOR]
![Stick Out Tongue](images/smilies/tongue.png)
angcheo:
Mã:
Sub GPE(Rng As Range, Targ)
Dim sRng As Range, MyAdd As String
Set sRng = Rng.Find(Targ, , xlFormulas, xlWhole)
If Not sRng Is Nothing Then
MyAdd = sRng.Address
Do
If sRng.Address <> MyAdd Then
MsgBox MyAdd, , "Chú Ý: Có Trùng"
Exit Sub
End If
Set sRng = Rng.FindNext(sRng)
Loop While Not sRng Is Nothing And sRng.Address <> MyAdd
End If
End Sub
Theo phong tục của người M’nông, khi đứa trẻ vừa tròn một mùa rẫy (nghĩa là vừa tròn một năm tuổi), cha mẹ đứa trẻ phải tiến hành làm lễ cắt tóc (krah soh) và lễ xỏ tai (chuh tor) cho con mình, nhằm...
Lễ cắt tóc (krah soh) và lễ xỏ tai (chuh tor) cho trẻ sơ sinh của người M’nông