Announcements
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\Desktop\\Power Automate Desktop\\Projects\\BOM Costing\\Archieve\\ExcelFile1.xlsx''' Visible: True ReadOnly: False Instance=> File1 Excel.ReadFromExcel.ReadAllCells Instance: File1 ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData1 Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\Desktop\\Power Automate Desktop\\Projects\\BOM Costing\\Archieve\\ExcelFile2.xlsx''' Visible: True ReadOnly: False Instance=> File2 SET RowValue TO 2 LOOP FOREACH CurrentItem IN ExcelData1 Excel.ClearCellsFromExcel.ClearSingleCell Instance: File2 SingleCellColumn: $'''D''' SingleCellRow: RowValue Excel.WriteToExcel.WriteCell Instance: File2 Value: CurrentItem[0] Column: $'''D''' Row: RowValue END
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\Desktop\\Power Automate Desktop\\Projects\\BOM Costing\\Archieve\\ExcelFile1.xlsx''' Visible: True ReadOnly: False Instance=> File1 Excel.ReadFromExcel.ReadAllCells Instance: File1 ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData1 Variables.RetrieveDataTableColumnIntoList DataTable: ExcelData1 ColumnNameOrIndex: 1 ColumnAsList=> ColumnAsList Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\Desktop\\Power Automate Desktop\\Projects\\BOM Costing\\Archieve\\ExcelFile2.xlsx''' Visible: True ReadOnly: False Instance=> File2 Excel.GetFirstFreeRowOnColumn Instance: File2 Column: $'''D''' FirstFreeRowOnColumn=> FirstFreeRowOnColumn Excel.ClearCellsFromExcel.ClearCells Instance: File2 StartColumn: $'''D''' StartRow: 2 EndColumn: $'''D''' EndRow: FirstFreeRowOnColumn - 1 Excel.WriteToExcel.WriteCell Instance: File2 Value: ColumnAsList Column: $'''D''' Row: 2
' Define variables for file paths Dim objExcel, objWorkbook1, objWorkbook2 Dim sourceRange, destinationRange Dim file1, file2 file1 = "%filepath1%" file2 = "%filepath2%" ' Create Excel application object Set objExcel = CreateObject("Excel.Application") ' Open the first workbook (file1) Set objWorkbook1 = objExcel.Workbooks.Open(file1) ' Open the second workbook (file2) Set objWorkbook2 = objExcel.Workbooks.Open(file2) ' Define the source range from column B in file1 Set sourceRange = objWorkbook1.Sheets(1).Range("B2:B" & objWorkbook1.Sheets(1).UsedRange.Rows.Count) ' Define the destination range starting from column D in file2 Set destinationRange = objWorkbook2.Sheets(1).Range("D2") ' Copy data from source to destination destinationRange.Resize(sourceRange.Rows.Count, sourceRange.Columns.Count).Value = sourceRange.Value ' Save the changes in the second workbook (file2) objWorkbook2.Save ' Close both workbooks and quit Excel objWorkbook1.Close False objWorkbook2.Close True objExcel.Quit ' Clean up Set objExcel = Nothing Set objWorkbook1 = Nothing Set objWorkbook2 = Nothing Set sourceRange = Nothing Set destinationRange = Nothing
SET filepath1 TO $'''C:\\Users\\Username\\Desktop\\Excel copy data\\Book1.xlsx''' SET filepath2 TO $'''C:\\Users\\Username\\Desktop\\Excel copy data\\Book2.xlsx''' @@copilotGeneratedAction: 'False' Scripting.RunVBScript.RunVBScript VBScriptCode: $'''\' Define variables for file paths Dim objExcel, objWorkbook1, objWorkbook2 Dim sourceRange, destinationRange Dim file1, file2 file1 = \"%filepath1%\" file2 = \"%filepath2%\" \' Create Excel application object Set objExcel = CreateObject(\"Excel.Application\") \' Open the first workbook (file1) Set objWorkbook1 = objExcel.Workbooks.Open(file1) \' Open the second workbook (file2) Set objWorkbook2 = objExcel.Workbooks.Open(file2) \' Define the source range from column B in file1 Set sourceRange = objWorkbook1.Sheets(1).Range(\"B2:B\" & objWorkbook1.Sheets(1).UsedRange.Rows.Count) \' Define the destination range starting from column D in file2 Set destinationRange = objWorkbook2.Sheets(1).Range(\"D2\") \' Copy data from source to destination destinationRange.Resize(sourceRange.Rows.Count, sourceRange.Columns.Count).Value = sourceRange.Value \' Save the changes in the second workbook (file2) objWorkbook2.Save \' Close both workbooks and quit Excel objWorkbook1.Close False objWorkbook2.Close True objExcel.Quit \' Clean up Set objExcel = Nothing Set objWorkbook1 = Nothing Set objWorkbook2 = Nothing Set sourceRange = Nothing Set destinationRange = Nothing''' ScriptOutput=> VBScriptOutput ScriptError=> ScriptError
If you found this helpful, check out my LinkedIn and YouTube for more cool stuff:
🔗 LinkedIn 📺 YouTube
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Mohsin Ali 426
11manish 349 Super User 2026 Season 2
M Bilal Khan 308