Subz Posted April 24, 2018 Posted April 24, 2018 (edited) Try something like: #include <Excel.au3> Local $sSourcePath = "C:\Users\JPSITI\Desktop\Autoit" If FileExists($sSourcePath) = 0 Then DirCreate($sSourcePath) Local $sTargetPath = "C:\Users\JPSITI\Desktop\Autoit" If FileExists($sTargetPath) = 0 Then DirCreate($sTargetPath) Local $sSourceBook = @ScriptDir & "\Test Scope.xlsx" ;$sSourcePath & "\Test Scope.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 10 $oSourceRange = _Excel_RangeRead($oSourceBook,"Test Scope","D" & $i) $sTargetBook = $sTargetPath & "\" & $x & ".xlsx" $oTargetBook = _Excel_BookOpen($oExcel, $sTargetBook) If @error Then $oTargetBook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oTargetBook, Default, $oSourceRange, "C" & $i) _Excel_BookSaveAs($oTargetBook, $sTargetBook, $xlWorkbookDefault) _Excel_BookClose($oTargetBook) $x += 1 Next Edited April 24, 2018 by Subz daisyco 1
daisyco Posted April 25, 2018 Author Posted April 25, 2018 Gosh..maannnn!! works like a charm! Thanks a lot man. Really owe you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now