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 77 78 79 80 81 82 83 84 85 86 87
| Public tab_données() As Variant
Public largeur_base_données As Integer, hauteur_base_données
Public Sub création_base_données()
largeur_base_données = Sheets("Données brutes").Range("BN10")
'MsgBox largeur_base_données
hauteur_base_données = Sheets("Données brutes").Range("A14").End(xlDown).Row
'MsgBox hauteur_base_données - 14
ReDim tab_données(hauteur_base_données - 14, largeur_base_données - 1)
Dim i As Integer, j
i = 0
For i = 0 To hauteur_base_données - 14
j = 0
tab_données(i, 0) = Range("A" & i + 14)
For j = 0 To largeur_base_données - 1
tab_données(i, j) = Range("A" & i + 14).Offset(0, j)
Next j
Next i
MsgBox "Nous allons maintenant vérifier le bon enregistrement de la base de donnée" & _
" " & "Veuillez donner un numéro de ligne compris entre 0 et" & " " & hauteur_base_données - 14
a = InputBox("Numéro de ligne ", "Title")
MsgBox "Veuillez donner un numéro de colonne compris entre 0 et" & " " & largeur_base_données - 1
b = InputBox("Numéro de colonne (1ère colonne <=> 0)", "Title")
MsgBox tab_données(a, b)[/COLOR]
Sub confort_été()
Dim temperature As String, occupation
Dim seuil As Integer
Dim total As Integer
temperature = Sheets("Résultats").Range("E32")
' MsgBox temperature
seuil = Sheets("Résultats").Range("E40")
' MsgBox seuil
'recherche d'une donnée dans une ligne et renvoie n°colonne
Set occupation_ok = Sheets("Données brutes").Rows("12").Find("Occupancy")
Set temperature_ok = Sheets("Données brutes").Rows("12").Find("temperature")
'Test abscence donnée
If occupation_ok Is Nothing Then
' numero_col = occupation_ok.Column
MsgBox ("donnée non trouvée")
Else
numero_col_a = occupation_ok.Column
MsgBox numero_col_a
End If
'renvoie numéro colonne pour le type de température à analyser
If temperature_ok Is Nothing Then
MsgBox ("donnée non trouvée")
Else
numero_col_b = temperature_ok.Column
MsgBox numero_col_b
End If
' hauteur_base_données - 14
total = 0
For i = 0 To hauteur_base_données - 14
If tab_données(i, numero_col_b - 1) >= seuil And tab_données(i, numero_col_a - 1) <> 0 Then
total = total + 1
End If
Next i
MsgBox total
End Sub |
Partager