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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| Private Sub CommandButton8_Click()
Sheet3.Rows("2:70").Delete
iL2 = Sheet1.Cells(100, 2).Value
n = 2
ratio = ComboBox3.Value
hubratio = ComboBox4.Value
If ratio <> "" And hubratio <> "" Then
For i = n To 160
celluleratio = ("m" & i)
cellulehubratio = ("k" & i)
nomratio = Sheet5.Range(celluleratio).Value
nomhubratio = Sheet5.Range(cellulehubratio).Value
If nomratio = ratio Then
If nomhubratio = hubratio Then
Sheet5.Cells(i, "k").Copy Sheet3.Cells(iL2, 3)
Sheet5.Cells(i, "m").Copy Sheet3.Cells(iL2, 4)
Sheet5.Cells(i, "a").Copy Sheet3.Cells(iL2, 1)
iL2 = iL2 + 1
End If
End If
Next
ElseIf ratio <> "" And hubratio = "" Then
For i = n To 160
celluleratio = ("m" & i)
nomratio = Sheet5.Range(celluleratio).Value
If nomratio = ratio Then
Sheet5.Cells(i, "k").Copy Sheet3.Cells(iL2, 3)
Sheet5.Cells(i, "m").Copy Sheet3.Cells(iL2, 4)
Sheet5.Cells(i, "a").Copy Sheet3.Cells(iL2, 1)
iL2 = iL2 + 1
End If
Next
ElseIf ratio = "" And hubratio <> "" Then
For i = n To 160
cellulehubratio = ("k" & i)
nomhubratio = Sheet5.Range(cellulehubratio).Value
If nomhubratio = ratio Then
Sheet5.Cells(i, "k").Copy Sheet3.Cells(iL2, 3)
Sheet5.Cells(i, "m").Copy Sheet3.Cells(iL2, 4)
Sheet5.Cells(i, "a").Copy Sheet3.Cells(iL2, 1)
iL2 = iL2 + 1
End If
Next
End If
ComboBox3.Value = Empty
ComboBox4.Value = Empty
Sheet3.Select
End Sub |
Partager