Bonjour,

J'ai déja codé du pascal il y a 30 ans puis plus rien alors je recommence ici avec une demande d'aide.

Je cherche a copier le sous total dans un fichier mais cette variable n'est pas toujours sur la meme ligne.
Quand il est sur la meme ligne j'arrive a le copier avec cette macro:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
Sub copiersoustotal()
'
 
    With Session
        .SetSelectionStartPos 12, 58
        .ExtendSelectionRect 12, 63
        .CopySelection
    End With
End Sub
j'ai demandé de l'aide sur un autre forum et qqu'un m'a écrit ce code pour m'aider mais sans aucun résultat.

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
Sub copiersoustotal()
'
    dim i as integer, nlig as integer
nlig=0
With Session
    for i = 5 to 22   
       if .GetDisplayText(i,11,9)="SUB-TOTAL" then 
          nlig=i
          exit for
       end if
    next i
    if nlig >0 then
        .SetSelectionStartPos nlig, 57
        .ExtendSelectionRect nlig, 63
        .CopySelection
    end if
    End With
End Sub
Et voici de quoi ressemble le document ou se trouve le montant(c'est pas du excel).

Nom : Capture.JPG
Affichages : 358
Taille : 114,5 Ko

Merci a ceux et celles qui voudrons bien m'aidé.