1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Dim app As Excel.Application
Dim wbk As Excel.Workbook
Dim feuille As Excel.Worksheets
Dim retour As Long
Dim trouver, exist As Boolean
Dim fichier, valeur As String
Dim last As Long
On Error Resume Next
fichier = Application.GetOpenFilename()
Set app = CreateObject("Excel.Application")
Set wbk = app.Workbooks.Open(fichier)
Set feuille = wbk.Worksheets("Liste")
last = 5
For i = 1 To last
valeur = feuille(Range("D" & i))
MsgBox valeur
If valeur = txtMatricule Then
trouver = True
exist = True
retour = i
Exit For
End If
Next
wbk.close() |
Partager