Bonjour à tous,
c'est mon premier post et je vous avoue que vos commentaires dépannent énormément. Je suis face à un souci sur VBA. J'ai un fichier pour la gestion des opérations et je souhaiterai insérer des lignes à partir de ma ligne de titre.
1) Voici le code utilisé (insertion de ligne) mais ça ne marche pas comme voulu.
Sub InsertionLignesRecopieFormules()
Dim x As Long
ActiveCell.EntireRow.Select 'So you do not have to preselect entire row'
If vRows = 0 Then
vRows = Application.InputBox(prompt:="Combien faut-il ajouter de lignes?", Title:="Ajouter des lignes", _
Default:=1, Type:=1) 'Default for 1 row, type 1 is number
If vRows = False Then Exit Sub
End If
Dim sht As Worksheet, shts() As String, i As Integer
ReDim shts(1 To Worksheets.Application.ActiveWorkbook.Windows(1).SelectedSheets.Count)
i = 0
For Each sht In Application.ActiveWorkbook.Windows(1).SelectedSheets
Sheets("2013").Select
i = i + 1
shts(i) = "2013"
x = Sheets("2013").UsedRange.Rows.Count 'lastcell fixup
selection.Resize(rowsize:=2).Rows(2).EntireRow.Resize(rowsize:=vRows).Insert Shift:=xlDown
selection.AutoFill selection.Resize(rowsize:=vRows + 1), xlFillDefault
selection.Offset(1).Resize(vRows).EntireRow.SpecialCells(xlConstants).ClearContents
Next sht
Worksheets(shts).Select
End Sub
2) Masquer des colonnes (par exemple en jaune)
Sub Macro1()
'
' Macro1 Macro
For c = 1 To 20
If Cells(16, c).Interior.ColorIndex = 6 Then
Columns(c).EntireColumn.Hidden = True
End If
Next
End Sub
Sub Macro2()
Cells.Select
Range("D1").Activate
selection.EntireColumn.Hidden = False
End Sub
Sub Macro3()
'
' Macro3 Macro
'
'
Range("F10:F11").Select
With selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End Sub
Je vous remercie vraiment de votre aide.