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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| Public i, ligne As Integer
Public derligne, premligne As Long
'detection IC
Sub Importdonnées()
' Bouton import des données
'
UserForm2.Show
End Sub
Sub runtimeTopo()
On Error Resume Next
Sheets.Add after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
ActiveSheet.Name = "Infos Points Topo"
derligne = Sheets("TABLE Points TOPO").Range("A1048576").End(xlUp).Row
premligne = Sheets("Infos Points Topo").Range("A1048576").End(xlUp).Row
For i = 2 To derligne
ligne = i + premligne - 1
Sheets("Infos Points Topo").Rows(ligne + 1).Insert
Call pointsTopo
Next
End Sub
Sub pointsTopo() '
' pointsTopo
'
Sheets("Infos Points Topo").Range("A" & ligne).Value = Sheets("TABLE Points TOPO").Range("A" & i).Value
Sheets("Infos Points Topo").Range("A1").Value = "N°"
Sheets("Infos Points Topo").Range("B" & ligne).Value = UCase(Mid(Sheets("TABLE Points TOPO").Range("C" & i).Value, 1, 2))
Sheets("Infos Points Topo").Range("B1").Value = "Type"
Sheets("Infos Points Topo").Range("C" & ligne).Value = Mid(Sheets("TABLE Points TOPO").Range("C" & i).Value, 3, 4)
Sheets("Infos Points Topo").Range("C1").Value = "Profondeur"
Sheets("Infos Points Topo").Range("D" & ligne).Value = Sheets("TABLE Points TOPO").Range("F" & i).Value
Sheets("Infos Points Topo").Range("D1").Value = "X"
Sheets("Infos Points Topo").Range("E" & ligne).Value = Sheets("TABLE Points TOPO").Range("G" & i).Value
Sheets("Infos Points Topo").Range("E1").Value = "Y"
Sheets("Infos Points Topo").Range("F" & ligne).Value = Sheets("TABLE Points TOPO").Range("H" & i).Value
Sheets("Infos Points Topo").Range("F1").Value = "Z"
'Colonne numéro'
Sheets("Feuil1").Range("B" & ligne).Value = Sheets("Infos Points Topo").Range("A" & i).Value
'Colonne Type'
Sheets("Feuil1").Range("A" & ligne).Value = Sheets("Infos Points Topo").Range("B" & i).Value
'Colonne X'
Sheets("Feuil1").Range("C" & ligne).Value = Round(WorksheetFunction.VLookup(Sheets("Feuil1").Range("B" & ligne).Value, Sheets("Infos Points Topo").Range("A1:Z2000"), 4, False), 3)
'Colonne Y'
Sheets("Feuil1").Range("D" & ligne).Value = Round(WorksheetFunction.VLookup(Sheets("Feuil1").Range("B" & ligne).Value, Sheets("Infos Points Topo").Range("A1:Z2000"), 5, False), 3)
'Colonne ZT'
Sheets("Feuil1").Range("E" & ligne).Value = Round(WorksheetFunction.VLookup(Sheets("Feuil1").Range("B" & ligne).Value, Sheets("Infos Points Topo").Range("A1:Z2000"), 6, False), 3)
'Colonne Profondeur'
Sheets("Feuil1").Range("G" & ligne).Value = WorksheetFunction.VLookup(Sheets("Feuil1").Range("B" & ligne).Value, Sheets("Infos Points Topo").Range("A1:Z2000"), 3, False)
End Sub
Sub BouclerSurLaTableDesTypes()
Dim AireDesTypes As Range, CelluleDesTypes As Range
Dim AireDesDonnees As Range, CelluleDesDonnees As Range
Dim DerniereColonne As Long, DerniereLigne As Long
Dim Chemin As String
Chemin = ThisWorkbook.Path & "\Export"
' Chemin = ThisWorkbook.Path
Set AireDesTypes = Sheets("Paramètres").ListObjects("TableDesTypes").DataBodyRange
With Sheets("Feuil1")
DerniereColonne = .UsedRange.SpecialCells(xlCellTypeLastCell).Column
DerniereLigne = .Cells(.Rows.Count, 1).End(xlUp).Row
Set AireDesDonnees = .Range(.Cells(1, 1), .Cells(DerniereLigne, 1))
End With
Application.ScreenUpdating = False
For Each CelluleDesTypes In AireDesTypes
Exporter2 AireDesDonnees, CelluleDesTypes, Chemin
Next CelluleDesTypes
Application.DisplayAlerts = False
Set AireDesTypes = Nothing
Set AireDesDonnees = Nothing
End Sub
Sub Exporter2(ByVal Airedesdonnees2 As Range, ByVal TypeChoisi As String, Chemin2 As String) 'copie sauvegarde rapport
Dim CheminCsv As String
Dim Plage As Range, oL As Range, oC As Range
Dim Tmp As String, Sep As String
CheminCsv = Chemin2 & "\" & TypeChoisi & ".csv"
Sep = ";"
Open CheminCsv For Output As #1
' Copie de la ligne de titre
Tmp = ""
Set Plage = Range(Airedesdonnees2(1), Airedesdonnees2(1).Offset(0, 6))
For Each oC In Plage
Tmp = Tmp & CStr(oC.Text) & Sep
Next oC
Print #1, Tmp
Set Plage = Nothing
For Each oL In Airedesdonnees2
Tmp = ""
If oL = TypeChoisi Then
Set Plage = Range(oL, oL.Offset(0, 6))
For Each oC In Plage
Tmp = Tmp & CStr(oC.Text) & Sep
Next oC
Print #1, Tmp
Set Plage = Nothing
End If
Next oL
Close
End Sub |