Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Sabina pe Simpatie
Femeie
22 ani
Bucuresti
cauta Barbat
22 - 60 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Index Match with VBA Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
Whenever someone would enter a value via drop down list in range C7:C25 (drop down list location in Sheet2), range D7:D25 would automatically be populated with the corresponding data coming from Sheet2.

This should be added in Sheet1 code:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count = 1 Then
        Application.EnableEvents = False
        If Not Intersect(Target, Range("$C$7:$C$25")) Is Nothing Then
            If Target = "" Then
                Target.Offset(, 1) = ""
            Else
                Target.Offset(, 1) = Application.Index(Sheet2.Range("B:B"), Application.Match(Target, Sheet2.Range("A:A"), 0))
            End If
        ElseIf Not Intersect(Target, Range("$D$7:$D$25")) Is Nothing Then
            If Target = "" Then
                Target.Offset(, -1) = ""
            Else
                Target.Offset(, -1) = Application.Index(Sheet2.Range("A:A"), Application.Match(Target, Sheet2.Range("B:B"), 0))
            End If
        End If
        Application.EnableEvents = True
    End If
End Sub


Source:


_______________________________________


pus acum 4 ani
   
Pagini: 1  

Mergi la