Assigner une variable comme étant la première case vide d'une colonne
Bonjour à tous,
Voici le code effectué ce jour :
Code:
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
| Sub IMPORTATION()
Application.DisplayAlerts = False
Dim fichier As String, chemin As String
Dim FichierPageFinale As String
Dim Repertoire As FileDialog
Dim Table As Variant
Dim wkA As Workbook, wkB As Workbook
Dim j As Long
Set Repertoire = Application.FileDialog(msoFileDialogFolderPicker)
Repertoire.Title = ("Choisir le r?pertoire")
Repertoire.Show
chemin = Repertoire.SelectedItems(1)
chemin = chemin & "\"
fichier = Dir(chemin & "*.xlsm")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Cursor = xlWait
Application.StatusBar = " TRAITEMENT EN COURS TRAITEMENT EN COURS TRAITEMENT EN COURS TRAITEMENT EN COURS TRAITEMENT EN COURS"
'On r?cup?re les informations sur le fichier
fichierSynthese = ActiveWorkbook.Name
j = 2
Do While fichier <> ""
Set Wb = Workbooks.Open(Filename:=chemin & fichier, Format:=5)
DoEvents
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 2) = Wb.Worksheets("Contexte").Range("F2")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 9) = Wb.Worksheets("Contexte").Range("O2")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 13) = Wb.Worksheets("Contexte").Range("I5")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 15) = Wb.Worksheets("Contexte").Range("H12")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 16) = Wb.Worksheets("Contexte").Range("E12")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 19) = Wb.Worksheets("Contexte").Range("D19")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 30) = Wb.Worksheets("Contexte").Range("C18")
Workbooks(fichierSynthese).Worksheets("SUIVI ACTIONS").Cells(j, 31) = Wb.Worksheets("Contexte").Range("H18")
j = j + 1
Wb.Close savechanges:=False
DoEvents
Set Wb = Nothing
fichier = Dir
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Cursor = xlDefault
Application.StatusBar = False
Columns("G:G").Select
Selection.NumberFormat = "m/d/yyyy"
Columns("I:I").Select
Selection.NumberFormat = "#,##0.00 $"
Selection.NumberFormat = "#,##0.0 $"
Selection.NumberFormat = "#,##0 $"
Columns("K:K").Select
Selection.NumberFormat = "m/d/yyyy"
Application.DisplayAlerts = True
End Sub |
J'aurais besoin que ma variable " j " soit définie non pas égale à 2 mais comme étant la première ligne en face de la première case vide de la colonne B...
Sauriez-vous m'aider ?
Merci
Ju