Sie sind auf Seite 1von 6

Public Sub test1()

MsgBox "la cellele s�l�ctionne� est au niveau da la ligne " & ActiveCell.Row
MsgBox "la cellele s�l�ctionne� est au niveau da la ligne " & ActiveCell.Column

End Sub
Public Sub Dame()
l = ActiveCell.Row
c = ActiveCell.Column
For i = 0 To 7
Cells(l + i, c + i).ColumnWidth = 10.71
Cells(l + i, c + i).RowHeight = 60
For j = 0 To 7
If (i + j) Mod 2 = 0 Then Cells(l + i, c + j).Interior.Color = RGB(255, 0, 0)
Next
Next
End Sub
Public Sub Dame1()
l = ActiveCell.Row
c = ActiveCell.Column
For i = 0 To 7
Cells(l + i, c + i).ColumnWidth = 10.71
Cells(l + i, c + i).RowHeight = 60
For j = 0 To 7
If (i + j) Mod 2 = 0 Then
Cells(l + i, c + j).Interior.Color = RGB(255, 0, 0)
Else
Cells(l + i, c + j).Interior.Color = RGB(0, 255, 0)
End If
Next
Next

End Sub
Public Sub afichage_produit_multiplication()
l = ActiveCell.Row
c = ActiveCell.Column
n = InputBox("entrer le nombre de cot�")
For i = 1 To n
Cells(l + i, c) = i
Cells(l, c + i) = i
Next
For i = 1 To n
For j = 1 To n
Cells(l + i, c + j) = i ^ j
Next
Next
End Sub

Public Sub Tableau_m�tr�()


l = ActiveCell.Row
c = ActiveCell.Column
Cells(l, 1) = ("N�")
Cells(2, 3) = ("D�signation")
Cells(2, 4) = ("Unit�")
Cells(2, 5) = ("Qt�")
Cells(2, 6) = ("PU")
Cells(2, 7) = ("Montant")
End Sub

Public Sub tableau()


l = ActiveCell.Row
c = ActiveCell.Column

Cells(l, c) = "N�"
Cells(l, c + 1) = "Designation"
Cells(l, c + 2) = "U"
Cells(l, c + 3) = "Qte"
Cells(l, c + 4) = "PU"
Cells(l, c + 5) = "Montant"
For i = 0 To 5
Cells(l, c + i).Interior.Color = RGB(220, 220, 220)
Next

For i = 0 To 5
For j = 0 To 20
Cells(l + j, c + i).Borders(xlEdgeBottom).Color = RGB(0, 0, 0)
Cells(l + j, c + i).Borders(xlEdgeTop).Color = RGB(0, 0, 0)
Cells(l + j, c + i).Borders(xlEdgeLeft).Color = RGB(0, 0, 0)
Cells(l + j, c + i).Borders(xlEdgeRight).Color = RGB(0, 0, 0)
Next
Next
'------------------------------------------------
Cells(l + 22, c + 4) = " Total H.T"
Cells(l + 23, c + 4) = " 20 % de T.V.A."
Cells(l + 24, c + 4) = " Total T.T.C."
For i = 22 To 24
Cells(l + i, c + 4).Interior.Color = RGB(220, 220, 220)
Cells(l + i, c + 4).Font.Bold = True
Cells(l + i, c + 4).HorizontalAlignment = xlLeft
Cells(l + i, c + 4).VerticalAlignment = xlCenter
Next

For i = 0 To 1
For j = 0 To 2
Cells(l + 22 + j, c + 4 + i).Borders(xlEdgeBottom).Color = RGB(0, 0, 0)
Cells(l + 22 + j, c + 4 + i).Borders(xlEdgeTop).Color = RGB(0, 0, 0)
Cells(l + 22 + j, c + 4 + i).Borders(xlEdgeLeft).Color = RGB(0, 0, 0)
Cells(l + 22 + j, c + 4 + i).Borders(xlEdgeRight).Color = RGB(0, 0, 0)
Next
Next
Cells(100000, 16000).Value = l
Cells(100001, 16000).Value = c

End Sub

Public Sub Calcul()


Dim l, c As Double
l = Cells(100000, 16000).Value
c = Cells(100001, 16000).Value
For i = 1 To 20
If Cells(l + i, c + 3).Value > 0 Then
Cells(l + i, c + 5).Value = Cells(l + i, c + 4).Value * Cells(l + i, c + 3)
End If
Next
Cells(100000, 16000).Value = Null
Cells(100001, 16000).Value = Null

End Sub

Public Sub CalculTV()


Dim l, c, somme As Double
l = Cells(100000, 16000).Value
c = Cells(100001, 16000).Value
somme = 0
For i = 1 To 20
If Cells(l + i, c + 3).Value > 0 Then
Cells(l + i, c + 5).Value = Cells(l + i, c + 4).Value * Cells(l + i, c + 3)
End If
Next
Cells(l + 22, c + 5).Value = somme
Cells(100001, 16000).Value = 0.2 * somme
Cells(100001, 16000).Value = 0.2 * somme

'Cells(100000, 16000).Value = Null


'Cells(100001, 16000).Value = Null

End Sub

Public Sub Num�roenlettre(n)


n = ActiveCell.Value

Select Case n
Case 0
result = "z�ro"
Case 1
result = "un"
Case 2
result = "deux"
Case 3
result = "trois"
Case 4
result = "quatre"
Case 5
result = "cinq"
Case 6
result = "six"
Case 7
result = "sept"
Case 8
result = "huit"
Case 9
result = "neuf"

MsgBox result

End Select
End Sub

Public Sub Num�roenlettre1()


n = ActiveCell.Value
MsgBox unite(n)
MsgBox unite(n / 2)
End Sub
Public Sub Num�roenlettre2()
n = ActiveCell.Value
If n <= 10 Then
result = unite(n)
ElseIf n < 20 Then
result = vingt(n)
Else
result = "Pas encore"
End If

MsgBox result

End Sub
Function unite(u)
Select Case u
Case 0: unite = "z�ro"
Case 1: unite = "un"
Case 2: unite = "deux"
Case 3: unite = "trois"
Case 4: unite = "quatre"
Case 5: unite = "cinq"
Case 6: unite = "six"
Case 7: unite = "sept"
Case 8: unite = "huit"
Case 9: unite = "neuf"
End Select
End Function

Function vingt(v)
Select Case v
Case 11: vingt = "onze"
Case 12: vingt = "un"
Case 13: vingt = "deux"
Case 14: vingt = "trois"
Case 15: vingt = "quatre"
Case 16: vingt = "cinq"
Case 17: vingt = "six"
Case 18: vingt = "sept"
Case 19: vingt = "huit"
Case 20: vingt = "vingt"

End Select
End Function
Public Sub Num�roenlettre3()
n = ActiveCell.Value
If n = 0 Then
result = "z�ro"
ElseIf n <= 10 Then
result = unite(n)
ElseIf n < 20 Then
result = vingt(n)
ElseIf n < 70 Then
If n Mod 10 = 1 Then
result = dizaine(Int(n / 10)) & " et " & unite(n Mod 10)
Else
result = dizaine(Int(n / 10)) & " " & unite(n Mod 10)
End If
ElseIf n < 100 Then
If n Mod 10 = 1 Then
result = dizaine(Int(n / 10) - 1) & " et " & vingt(n - (Int(n / 10) - 1) * 10)
Else
result = dizaine(Int(n / 10) - 1) & " " & vingt(n - (Int(n / 10) - 1) * 10)
End If
Else
result = "Pas encore"
MsgBox result
End Sub

Function cent(c)

n = ActiveCell.Value
If n = 0 Then
result = "z�ro"
ElseIf n <= 10 Then
result = unite(n)
ElseIf n < 20 Then
result = vingt(n)
ElseIf n < 70 Then
If n Mod 10 = 1 Then
result = dizaine(Int(n / 10)) & " et " & unite(n Mod 10)
Else
result = dizaine(Int(n / 10)) & " " & unite(n Mod 10)
End If
ElseIf n < 100 Then
If n Mod 10 = 1 Then
result = dizaine(Int(n / 10) - 1) & " et " & vingt(n - (Int(n / 10) - 1) * 10)
Else
result = dizaine(Int(n / 10) - 1) & " " & vingt(n - (Int(n / 10) - 1) * 10)
End If
Else
result = "Pas encore"
MsgBox result
End Sub

Public Sub num�roenlettre1000000()


n = ActiveCell.Value
If n <= 1000 Then
result = mille(n)
ElseIf n = 1000 Then
result = "mille"
ElseIf n < 1000000 Then
result = mille(Int(n / 1000)) & " mille" & mille(n - Int(n / 1000) * 1000)
Else
result = "Pas encore"
End If
MsgBox result
End Sub

Function mille()
If n < 100 Then
mille = cent(n)
ElseIf n = 100 Then
mille = "cent"

End Function

Das könnte Ihnen auch gefallen