1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Function CompteTVA(Cpt As String) As Double
Select Case Cpt
Case "c70600000": CompteTVA = 19.6
Case "c70600900": CompteTVA = 5.5
Case Else: CompteTVA = 0
End Select
End Function
Sub macro()
Dim Lig_Deb As Long, Lig_Fin As Long, i As Long
Dim compte As String
Lig_Deb = InputBox("Saisir le 1er numéro de ligne de la classe 7 ?")
With ThisWorkbook.Sheets("Feuil1")
Lig_Fin = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = Lig_Deb To Lig_Fin
compte = "c" & .Cells(i, 1).Value
.Cells(i, 7).Value = CompteTVA(compte)
Next i
End With
End Sub |
Partager