#include Local $sSourcePath = "C:\Users\Desktop\Scripts" If FileExists($sSourcePath) = 0 Then DirCreate($sSourcePath) Local $sTargetPath = "C:\Users\Desktop\Scripts\" If FileExists($sTargetPath) = 0 Then DirCreate($sTargetPath) Local $sSourceBook = $sSourcePath & "\Doc 1.xlsx" Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(4096, "Excel Error", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oSourceBook = _Excel_BookOpen($oExcel, $sSourceBook) If @error Then MsgBox(4096, "Excel Error", "Error opening workbook '" & $sSourceBook & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf Local $oSourceRange, $oTargetBook, $sTargetBook, $x = 1 For $i = 4 To 53 ;Copy & Paste essential 1 $oSourceRange1 = _Excel_RangeRead($oSourceBook,"Doc1","E" & $i) $sTargetBook = $sTargetPath & "\" & $oSourceRange1 &".xlsx" $oTargetBook = _Excel_BookOpen($oExcel, $sTargetBook) If @error Then $oTargetBook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oTargetBook, Default, $oSourceRange1, "C3") ;Copy & Paste essential 2 $oSourceRange = _Excel_RangeRead($oSourceBook,"Doc1","D" & $i) $sTargetBook = $sTargetPath & "\" & $oSourceRange1 &".xlsx" $oTargetBook = _Excel_BookOpen($oExcel, $sTargetBook) If @error Then $oTargetBook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oTargetBook, Default, $oSourceRange, "C4",True,True) ;Save and close test case book _Excel_BookSaveAs($oTargetBook, $sTargetBook, $xlWorkbookDefault) _Excel_BookClose($oTargetBook) $x += 1 Next