Cập nhật DataValidation 2 chiều giữa 2 sheet (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

Tôi tuân thủ nội quy khi đăng bài
Gửi Anh/Chị,
Em đang tìm phương án cập nhật DataValidation 2 chiều giữa 2 sheet.
Nhờ Anh/Chị hỗ trợ.

Em cám ơn.
Mã VBA cho Sheet1:
Mã:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ws2 As Worksheet
    Set ws2 = ThisWorkbook.Sheets("Sheet2")

    ' Ki?m tra n?u ô thay d?i là DataValidation1
    If Not Intersect(Target, Me.Range("E4")) Is Nothing Then
        Application.EnableEvents = False
        ws2.Range("D3").Value = Target.Value
        Application.EnableEvents = True
    End If
End Sub

Mã VBA cho Sheet2:
Mã:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ws1 As Worksheet
    Set ws1 = ThisWorkbook.Sheets("Sheet1")

    ' Ki?m tra n?u ô thay d?i là DataValidation2
    If Not Intersect(Target, Me.Range("D3")) Is Nothing Then
        Application.EnableEvents = False
        ws1.Range("E4").Value = Target.Value
        Application.EnableEvents = True
    End If
End Sub
 
Mã VBA cho Sheet1:
Mã:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ws2 As Worksheet
    Set ws2 = ThisWorkbook.Sheets("Sheet2")

    ' Ki?m tra n?u ô thay d?i là DataValidation1
    If Not Intersect(Target, Me.Range("E4")) Is Nothing Then
        Application.EnableEvents = False
        ws2.Range("D3").Value = Target.Value
        Application.EnableEvents = True
    End If
End Sub

Mã VBA cho Sheet2:
Mã:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ws1 As Worksheet
    Set ws1 = ThisWorkbook.Sheets("Sheet1")

    ' Ki?m tra n?u ô thay d?i là DataValidation2
    If Not Intersect(Target, Me.Range("D3")) Is Nothing Then
        Application.EnableEvents = False
        ws1.Range("E4").Value = Target.Value
        Application.EnableEvents = True
    End If
End Sub
Dạ, đúng cái em cần.
Cám ơn Anh/Chị hoangtuaotrang_hp_vn
 
Web KT

Bài viết mới nhất

Back
Top Bottom