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
| Private Sub AddVibrationCol()
Dim LastCol As Integer, Idx As Integer
Dim TmpStr As String
LastCol = ThisWorkbook.Sheets(1).Range("A20").CurrentRegion.Columns.Count
If LastCol > 15 Then Exit Sub
ThisWorkbook.Sheets(1).Columns(13).Copy _
Destination:=ThisWorkbook.Sheets(1).Cells(1, LastCol + 1)
Idx = LastCol + 2 - 13
TmpStr = "Vibrations " & Idx & " Max (mm/s)"
ThisWorkbook.Sheets(1).Cells(20, LastCol + 1) = TmpStr
ThisWorkbook.Sheets(1).Cells(27, LastCol + 1) = TmpStr
ThisWorkbook.Sheets(1).Cells(34, LastCol + 1) = TmpStr
AdaptAll
End Sub
Private Sub DelVibrationCol()
Dim LastCol As Integer, Idx As Integer
LastCol = ThisWorkbook.Sheets(1).Range("A20").CurrentRegion.Columns.Count
If LastCol = 13 Then Exit Sub
ThisWorkbook.Sheets(1).Columns(LastCol).Delete
AdaptAll
End Sub
Private Sub AdaptAll()
Dim LastCol As Integer
Dim Plage As Range
Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets(1)
LastCol = ThisWorkbook.Sheets(1).Range("A20").CurrentRegion.Columns.Count
Set Plage = Sh.Range(Sh.Cells(4, 1), Sh.Cells(5, LastCol))
Plage.MergeCells = True ' Elargissement des cellules fusionnée de la ligne 26
Set Plage = Sh.Range(Sh.Cells(19, 1), Sh.Cells(19, LastCol))
Plage.MergeCells = True ' Elargissement des cellules fusionnée de la ligne 19
Set Plage = Sh.Range(Sh.Cells(26, 1), Sh.Cells(26, LastCol))
Plage.MergeCells = True ' Elargissement des cellules fusionnée de la ligne 26
Set Plage = Sh.Range(Sh.Cells(33, 1), Sh.Cells(33, LastCol))
Plage.MergeCells = True ' Elargissement des cellules fusionnée de la ligne 33
Set Plage = Sh.Range(Sh.Cells(1, LastCol), Sh.Cells(38, LastCol))
Plage.Borders(xlEdgeLeft).Weight = xlThin ' modification des bordures
Plage.Borders(xlEdgeRight).Weight = xlMedium ' de la dernière colonne
Set Sh = Nothing
Set Plage = Nothing
End Sub |