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 67 68 69 70 71 72 73 74 75 76
| Option Explicit
Option Compare Text
Global ThisWorkbook As Workbook
Global MyMainSheet As Worksheet
Global i, j, cmpti, cmptj As Integer
Sub AjoutValeurs()
Dim TabInput()
Set ThisWorkbook = ActiveWorkbook
Set MyMainSheet = ThisWorkbook.Worksheets("Sheet1")
MyMainSheet.Select
Dim TabRNG()
TabRNG = MyMainSheet.Range(Cells(3, 2), Cells(3, 2).End(xlDown))
Dim MytabCons() As String
Dim MytabVoy() As String
Dim MotTest()
For i = 1 To UBound(TabRNG, 1)
For j = 1 To 1
MsgBox TabRNG(i, j)
MotTest = TabRNG
'ConsOuVoy (MotTest(i, j))
MytabCons(i, j) = EstConsonne(MotTest(i, j))
MytabVoy(i, j) = EstConsonne(MotTest(i, j))
Next j
Next i
MyMainSheet.Range(Cells(3, 4), Cells(3, 4).End(xlDown)) = MytabCons
MyMainSheet.Range(Cells(3, 5), Cells(3, 5).End(xlDown)) = MytabVoy
End Sub
Function EstConsonne(ByVal MotTest As String) As Boolean
Dim motConsonne As String
Dim motVoyelle As String
If Left(CStr(MotTest), 1) = "a" Or Left(CStr(MotTest), 1) = "e" Or Left(CStr(MotTest), 1) = "i" Or Left(CStr(MotTest), 1) = "u" Then
MsgBox MotTest & " commence par une voyelle "
motVoyelle = MotTest
EstConsonne = False
Else
MsgBox MotTest & " commence par une consonne"
EstConsonne = True
End If
If EstConsonne = True Then
EstConsonne = MotTest
Else
motVoyelle = MotTest
End If
End Function |
Partager