Bonjour,

Voilà j'ai un petit souci sur lequel je planche depuis ce matin. D'abord le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
    namenew = Db & "|" & project    'new name of the future sheet

    If Not existsheet Then
        Workbooks(actualname).Sheets.Item("Template").Copy After:=Workbooks(actualname).Sheets.Item("Synergy_Configuration")    'copy of the sheet "Template" after the sheet "Synergy_Configuration
        ActiveSheet.Name = namenew  'the new sheet is rename with namenew
        Set wsProject = ActiveWorkbook.Sheets.Item(namenew) ''initialization of wsProject as the name of the sheet "namenew"
   Else
        crState = ""    'initialization of the values of the column "Change" of the sheet "Template"
   End If

   
    
'select the data in the ProjectName sheet to update the graph automatically
    Sheet(wsProject).Select

    Dim a, b, c, d As Integer
    a = 3 'end column
    b = 1 'start column
    c = 3 'end line
    d = 3 'start line
    
    'Column Iteration
    Do
    a = a + 1
    Loop Until IsEmpty(Cells(b, a).Value)
    a = a - 1
    MsgBox a
        
    'Row Iteration
    Do
    c = c + 1
    Loop Until IsEmpty(Cells(c, a).Value)
    c = c - 1
    MsgBox c
 
    ActiveWorkbook.Names.Add Name:="LastData", RefersToR1C1:="='wsProject'!R" & d & "C" & b & ":R" & c & "C" & a
J'ai mis en Gras les lignes que je n'arrive pas à faire fonctionner.
Ce programme me permet de sélectionner une feuille dans laquelle je renomme une plage de cellules. Cela marche très bien quand je mets le VRAI NOM de la feuille. Mais, je voudrais que cela passe par sa référence car son nom peut changer. (Je vous ai donné aussi le bout de code où je créé ma feuille automatiquement).

J'espère que vous pourrez m'aider !!!