#include Global $sPrevious = "", $iRowCount = 0, $sClipData = "", $iStartColumn = 0, $iEndColumn = 7 Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\Local\test.xlsx") Global $aUsedRange = _Excel_RangeRead($oWorkbook) _Excel_BookClose($oWorkbook) _Excel_Close($oExcel) _ArraySort($aUsedRange, 0, 1) ; Sort ascending on column 0 (first column), ignores header line _ArrayDisplay($aUsedRange) For $iRow = 1 To UBound($aUsedRange, 1) - 1 ; Column A has changed. Add processing of the previous block here If $sPrevious <> $aUsedRange[$iRow][0] And $sPrevious <> "" Then ClipPut($sClipData) If MsgBox($MB_OKCANCEL, "Test-Script", "Column A changed from '" & $sPrevious & "' to '" & $aUsedRange[$iRow][0] & "'. " & $iRowCount & " rows processed." & @CRLF & _ "Data has been copied to the clipboard. Please press 'OK' to continue or 'Cancel' to end the script.") = $IDCANCEL Then Exit $iRowCount = 0 $sClipData = "" EndIf $sPrevious = $aUsedRange[$iRow][0] ; Write all columns of the current row to a variable For $iColumn = $iStartColumn To $iEndColumn ; If you want to process all used columns use: UBound($aUsedRange, 2) - 1 If $iColumn = $iStartColumn Then If $iRowCount = 0 Then ; First row of a new block $sClipData = $aUsedRange[$iRow][$iColumn] Else $sClipData = $sClipData & @CRLF & $aUsedRange[$iRow][$iColumn] EndIf Else $sClipData = $sClipData & @TAB & $aUsedRange[$iRow][$iColumn] EndIf Next $iRowCount = $iRowCount + 1 Next ; End of table reached. Add processing of the last block here ClipPut($sClipData) MsgBox($MB_OKCANCEL, "Test-Script", "End of table reached. " & $iRowCount & " rows processed." & @CRLF & _ "Data has been copied to the clipboard.")