Problème avec exel VBA
michelj64
-
michel_m Messages postés 18903 Date d'inscription Statut Contributeur Dernière intervention -
michel_m Messages postés 18903 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour
J'ai un dossier avec 14 feuillets
- un appelé identité
- un pour les sommations
- 12 (1 par mois)
(j'ai reçu une aide de VIA (merci))
Je suis positionné sur un des mois et j'active une procédure rajout qui doit entre autres mailler le fichier exel
or je mets à jour le feuillet identité pour le maillage au lieu de le faire sur le mois appelant
voir
Public fin As Long
Public mois As Integer
Public page As Variant
Public moiscourant As Variant
Sub rajout()
'selectionne depuis la ligne de fin jusqu'à 30 lignes de plus et met les bordures
Set moiscourant = Worksheets(mois)
moiscourant.Range("A" & fin & ":H" & fin + 30).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'ligne fin à Fin + 30 dévérouillées
Sheets(page).Select
ActiveSheet.Unprotect
Range("A" & fin & ":H" & fin + 30).Select
ActiveWindow.SmallScroll Down:=fin + 30
Range("A" & fin & ":H" & fin + 30).Select
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingColumns:=True, AllowInsertingRows:=True, _
AllowDeletingColumns:=True, AllowDeletingRows:=True
' inscris la nouvelle der ligne du mois dans Identité
Sheets("Identité").Range("B" & mois + 15) = fin + 30
End Sub
MERCI
J'ai un dossier avec 14 feuillets
- un appelé identité
- un pour les sommations
- 12 (1 par mois)
(j'ai reçu une aide de VIA (merci))
Je suis positionné sur un des mois et j'active une procédure rajout qui doit entre autres mailler le fichier exel
or je mets à jour le feuillet identité pour le maillage au lieu de le faire sur le mois appelant
voir
Public fin As Long
Public mois As Integer
Public page As Variant
Public moiscourant As Variant
Sub rajout()
'selectionne depuis la ligne de fin jusqu'à 30 lignes de plus et met les bordures
Set moiscourant = Worksheets(mois)
moiscourant.Range("A" & fin & ":H" & fin + 30).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'ligne fin à Fin + 30 dévérouillées
Sheets(page).Select
ActiveSheet.Unprotect
Range("A" & fin & ":H" & fin + 30).Select
ActiveWindow.SmallScroll Down:=fin + 30
Range("A" & fin & ":H" & fin + 30).Select
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingColumns:=True, AllowInsertingRows:=True, _
AllowDeletingColumns:=True, AllowDeletingRows:=True
' inscris la nouvelle der ligne du mois dans Identité
Sheets("Identité").Range("B" & mois + 15) = fin + 30
End Sub
MERCI
A voir également:
- Problème avec exel VBA
- Exel 2013 - Télécharger - Tableur
- Liste deroulante exel - Guide
- Excel compter cellule couleur sans vba - Guide
- Moyenne exel - Guide
- Comment trier sur exel - Guide