How to select range with different row with comma

Viewed 22

I want to select the range A4:N6 then jump to another row A7:N7 and get one image combined so in excel it will be A4:N6,A7:N7, i don't know if its possible ?

import win32com.client as client
from PIL import ImageGrab

excel = client.Dispatch('Excel.Application')
wb = excel.Workbooks.Open('Suivi.xlsm')
sheet = wb.Sheets[14]
copyrange= sheet.Range('A4:N6,A7:N7') # Here i want to integrate the comma but it dont work (this is the excel format only)

copyrange.CopyPicture(Appearance=1, Format=2)

ImageGrab.grabclipboard().save('image.png')

Error when i launch the script :

File "\\N\5 - Conduite Activité\Envoi stat tech\new.py", line 7, in <module>
    copyrange= sheet.Range('A4:N6,A7:N7')
  File "<COMObject <unknown>>", line 2, in Range
        
0 Answers
Related