Option Explicit
Sub Main()
Dim wks As Worksheet
Set wks = Worksheets("Feuil1")
Dim Rgn As Range
Set Rgn = wks.Range("A1").CurrentRegion
'
Dim oInteret As ClsInteret
'
' Montant Variables
Dim Montant As Double, TypeInteret As String
' Lire les données
Dim i As Long, Resultat As Double
For i = 2 To Rgn.Rows.Count
Montant = Rgn.Cells(i, 1).Value
TypeInteret = Rgn.Cells(i, 2).Value
'
Set oInteret = QuelClass(TypeInteret)
'
' Montant
oInteret.Calculer Montant
' Impression Resultat
oInteret.ResultatImpression
Next i
End Sub
Function QuelClass(ByVal TypeInteret As String) As ClsInteret
Dim oInteret As ClsInteret
If TypeInteret = "A" Then
Set oInteret = New ClsInteretA
ElseIf TypeInteret = "B" Then
Set oInteret = New ClsInteretB
ElseIf TypeInteret = "C" Then
Set oInteret = New ClsInteretC
Else
MsgBox "Type Non Trouvé " & TypeInteret
End If
Set QuelClass = oInteret
End Function