Skip to main content

Notifications

Power Automate - Power Automate Desktop
Unanswered

Cannot copy active cells from 1 excel to another excel

Posted on 29 Nov 2024 06:29:36 by 2
Hello
 
I was trying to copy all active cells in 1 excel sheet "Excellnstance" to another excel "Excellnstance2". I have launched both excels using Launch Excel and there is only 1 sheet in each excel. But an error message pops up saying "Argument "Instance" must be "ExcellnstanceHandle". I provide a screenshot in below. 
 
Does anyone know what does that mean and how do I solve it?
 
  • Suggested answer
    Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 5,903 on 02 Dec 2024 at 05:40:42
    Cannot copy active cells from 1 excel to another excel
    Hi there,
     
    Please consider to follow the below approach:
     
     
     
    Code:(Copy and paste into your power automate desktop designer screen)
    
    **REGION Launch and open the source Excel file, copy the currently selected cells, launch and open the target Excel file, paste the copied cells, and close and save both Excel files
    Excel.LaunchExcel.LaunchAndOpen Path: $'''C:\\Boot\\source.xlsx''' Visible: True ReadOnly: False LoadAddInsAndMacros: False Instance=> SourceExcelInstance
    Excel.CopyCellsFromExcel.Copy Instance: SourceExcelInstance
    Excel.LaunchExcel.Launch Visible: True LoadAddInsAndMacros: False Instance=> TargetExcelInstance
    
    Excel.PasteCellsToExcel.Paste Instance: TargetExcelInstance
    
    Excel.CloseExcel.CloseAndSave Instance: SourceExcelInstance
    
    Excel.CloseExcel.CloseAndSave Instance: TargetExcelInstance
    
    **ENDREGION
    
    Thanks,
    Deenuji Loganathan đź‘©â€Ťđź’»
    Power Automate Desktop Community Champion đź¤–
    Follow me on LinkedIn đź‘Ą

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution âś” and like my suggestion ❤️  Your feedback supports future seekers đźš€
  • lbendlin Profile Picture
    lbendlin 7,828 on 30 Nov 2024 at 15:15:27
    Cannot copy active cells from 1 excel to another excel
    There is no concept of "active cells".  You have sheets, tables, and named ranges. Pick whatever is appropriate in your situation and then address these artifacts explicitly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard