Dim mesInfos() As InformationsAppels Call ObtentionHistorique(mesInfos) MsgBox UBound(mesInfos)
Option Explicit 'Définition du type Type InformationsAppels DateAppel As Date NbAppels As Double ComTech As String Activite As String End Type Sub CalculPrev() Dim month As Integer Dim year As Integer Dim i As Integer 'Définit le tableau d'enregistrement Dim HistoricalData() As InformationsAppels Dim Prev(62) As InformationsAppels month = ThisWorkbook.Sheets("Summary").Cells(16, 3).Value year = ThisWorkbook.Sheets("Summary").Cells(18, 3).Value For i = 1 To 31 If IsDate(i & "/" & month & "/" & year) Then Prev(i).DateAppel = i & "/" & month & "/" & year End If Next i For i = 32 To 62 If IsDate(i & "/" & month & "/" & year) Then Prev(i).DateAppel = i & "/" & month & "/" & year End If Next i ObtentionHistorique HistoricalData Previsions HistoricalData, Prev End Sub Sub ObtentionHistorique(ByRef Infos() As InformationsAppels) Dim continuer As Boolean Dim i As Long ReDim Infos(0 To 1) 'Définit la taille du tableau i = 1 continuer = True While continuer 'If ThisWorkbook.Sheets("DATABASE").Cells(i, 7).Value = "Global" Then Infos(i).DateAppel = ThisWorkbook.Sheets("DATABASE").Cells(i + 1, 1).Value Infos(i).NbAppels = ThisWorkbook.Sheets("DATABASE").Cells(i + 1, 3).Value Infos(i).ComTech = ThisWorkbook.Sheets("DATABASE").Cells(i + 1, 6).Value Infos(i).Activite = ThisWorkbook.Sheets("DATABASE").Cells(i + 1, 7).Value ' End If continuer = (ThisWorkbook.Sheets("DATABASE").Cells(i + 2, 1).Value <> "") ReDim Infos(1 To 2) i = i + 1 Wend End Sub
ReDim Preserve Infos(i To i+1) i = i + 1 Wend End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question