This works: $oExcel.Application.Union($oExcel.Application.ActiveSheet.Range("A2:K9"),$oExcel.Application.ActiveSheet.Range("A12:K19")).SelectBut this dont: $Range[0] = '$oExcel.Application.ActiveSheet.Range("A2:K9")'
$Range[1] = '$oExcel.Application.ActiveSheet.Range("A12:K19")'
$oExcel.Application.Union($Range[0],$Range[1]).SelectHow can i make it work ? I am planning on converting the array to a string and paste it as argument of the union as the number of ranges to be combined varies.