ngày 27-02-2024
Private Sub Worksheet_Change(ByVal giatri_chon As Range) 'Updated by Extendoffice 20240118 - Vietnamese version Dim giatri1, giatri2 As String Dim kytu_ngancach As String Dim vung_dulieu, vung_chon As Range
Set vung_dulieu = Me.UsedRange kytu_ngancach = ", "
If giatri_chon.Count > 1 Or Intersect(giatri_chon, vung_dulieu) Is Nothing Then Exit Sub On Error Resume Next Set vung_chon = vung_dulieu.SpecialCells(xlCellTypeAllValidation) If vung_chon Is Nothing Then Exit Sub Application.EnableEvents = False
giatri2 = giatri_chon.Value Application.Undo giatri1 = giatri_chon.Value giatri_chon.Value = giatri2 If giatri1 <> "" And giatri2 <> "" Then If Not (giatri1 = giatri2 Or _ InStr(1, giatri1, delimiter & giatri2) > 0 Or _ InStr(1, giatri1, giatri2 & delimiter) > 0) Then giatri_chon.Value = giatri1 & kytu_ngancach & giatri2 Else giatri_chon.Value = giatri1 End If End If
Application.EnableEvents = True On Error GoTo 0 End Sub |
Trung Tâm Tin Học Trường ĐH KHTN, ĐHQG-HCM