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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Sub Test()
Dim Msg As String, Title As String
Dim Wbk As Workbook
Dim Prs As Double
Dim L As Long
Dim Fichier
Application.DisplayAlerts = False
Fichier = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If Fichier <> False Then
Set Wbk = Workbooks.Open(Fichier)
Msg = "Veuillez saisir votre longueur"
Title = "-------PRS--------"
L = Val(InputBox(Msg, Title, Default))
With Wbk.Worksheets(1)
If L <= 1000 * .Cells(23, 41).Value Then
.Cells(23, 41).Value = L / 1000
Prs = .Cells(25, 41).Value
ElseIf L <= 1000 * .Cells(23, 42).Value Then
.Cells(23, 42).Value = L / 1000
Prs = .Cells(25, 42).Value
ElseIf L >= 1000 * .Cells(23, 43).Value Then
.Cells(23, 43).Value = L / 1000
Prs = .Cells(25, 43).Value
End If
End With
Wbk.Close True
Set Wbk = Nothing
cible = c
On Error Resume Next
x = Apllication.Match(Cible,ThisWorkbook.Worksheets("PRS data").colomns("A:A"),0)
if x= 0 Then
MsgBox "Valeur" & Cible & "non trouvée."
Else
ThisWorkbook.Worsheets("PRS data").Cells(x,6).value = PRS
MsgBox "Valeur " & Cible & " trouvée dans la ligne:" & x
End If
End If
End If
End Sub |
Partager