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
| Private Sub CommandButton10_Click()
'Déclaration des variables
Dim Feuille As Worksheet
Dim Dossier As String
Dim MonGraphique As Object
'On Error GoTo 1 'Affectation des variables
Set Feuille = Sheets("Feuil2") 'On sélectionne le nom de la feuille ou se trouve le graphe
Set MonGraphique = Feuille.ChartObjects(1).Chart 'On affecte le nom du graphique
'On choisit le chemin ou sauvegarder le graphique en tant qu'image
Dossier = "D:\Projet POIC\ImageGraph.jpg"
MonGraphique.Export Dossier 'Exporte le graphique dans le dossier
Me.Image1.Picture = LoadPicture(Dossier) 'On charge l'image du graphique dans le controle Image 1
End Sub
Private Sub CommandButton11_Click()
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer
Dim j As Integer
Dim x As Integer
Dim LigneD As Long
Dim ligneA As Long
Set wb = Workbooks.Open("D:\Fichier BCS.xlsm")
Set ws = ActiveWorkbook.Worksheets("BCS")
Range("A1:K65536").Select
ActiveWorkbook.Worksheets("BCS").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("BCS").Sort.SortFields.Add Key:=Range("A2:K65536"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("BCS").Sort
.SetRange Range("A1:K65536")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Appli
End With
MsgBox "le fichier est ouvert"
ligneA = ActiveWorkbook.Worksheets("Feuil1").Columns(1).Find("*", , , , xlByColumns, xlPrevious).Row + 1
MsgBox "la dernière ligne du fichier est :" & ligneA
LigneD = ActiveWorkbook.Worksheets("ws").Columns(1).Find("*", , , , xlByColumns, xlPrevious).Row
MsgBox "la dernière ligne de BCS est :" & LigneD
For n = 2 To LigneD
temp = "=VLookup(IF(IFERROR(VLOOKUP(Worksheets("BCS").Range("A"& i),Worksheet("Feuil1").Range($A:$A),1,FAUX)),1,0)"
If temp = 0 Then
Sheets("BCS").Select
ActiveSheet.Range("A" & n & ":K" & n).Select
Selection.Copy
Sheets("Feuil1").Select
ligneA = Sheets("Feuil1").Columns(1).Find("*", , , , xlByColumns, xlPrevious).Row + 1
Sheets("Feuil1").Range("A" & ligneA).Select
ActiveSheet.Paste
x = x + 1
End If |
Partager