Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

XL 2019 copy filtered range to jpeg

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

duplaly

XLDnaute Occasionnel
Hi
I'm trying to find the good way to transform that vba code for a fixed range.

'Create JPG file of the range
'Only enter the Sheet name and the range address
MakeJPG = CopyRangeToJPG("Rapport", "A1:H108")

to a filtered range

'Only the visible cells in the selection
Dim lr As Long
lr = Sheets("Registre").Cells(Application.Rows.Count, 1).End(xlUp).Row
Set Rng = Sheets("Rapport").Range("A1:H" & lr).SpecialCells(xlCellTypeVisible)

Any help!!

Thanks!
 
Salut, qqch comme ceci, à adapter à ton contexte.

VB:
Option Explicit

Sub Export()
Dim oWs As Worksheet
Dim oRng As Range
Dim oChrtO As ChartObject
Dim lWidth As Long, lHeight As Long

    Set oWs = ActiveSheet
    Set oRng = oWs.Range("B2:H11")

    oRng.CopyPicture xlScreen, xlPicture
    lWidth = oRng.Width
    lHeight = oRng.Height

    Set oChrtO = oWs.ChartObjects.Add(Left:=0, Top:=0, Width:=lWidth, Height:=lHeight)

    oChrtO.Activate
    With oChrtO.Chart
        .Paste
        .Export Filename:=ThisWorkbook.Path & "\" & "Range2JPEG.jpg", Filtername:="JPG"
    End With

    oChrtO.Delete
End Sub
 
Dernière édition:
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…