Simpatie.ro - matrimoniale
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.
Nou pe simpatie:
Kalifa
Femeie
24 ani
Ialomita
cauta Barbat
24 - 65 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[EXCEL] Index Match with VBA

Pagini: 1 Moderat de TRaP, TonyTzu
#1
Mrrrr
AdMiN
Postari: 2388
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:
https://www.excelforum.com/excel-formul ... ation.html


_______________________________________


 
   
Pagini: 1  
Mergi la