Guest User

Untitled

a guest
Jan 4th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. `
  2. $ExportFile = "I:SCRIPTIPCNewScriptResult.csv"
  3.  
  4.  
  5. $xlShiftDown = -4121
  6. $objExcel=New-Object -ComObject Excel.Application
  7. #$objExcel.Visible=$true
  8. $objExcel.DisplayAlerts = FALSE
  9.  
  10. $WorkBook=$objExcel.Workbooks.Open($ExportFile)
  11.  
  12. $worksheet = $workbook.sheets.item("Result")
  13.  
  14.  
  15. #Get row & column count
  16. $objRange = $worksheet.UsedRange
  17. $RowCount = $objRange.Rows.Count
  18. $ColumnCount = $objRange.Columns.Count
  19.  
  20.  
  21.  
  22. for ( $i=3 ; $i -le 4; $i ++ ){
  23. $inc = 1
  24. $NexRow = $i + $inc
  25. for ( $j=1 ; $j -le 3; $j ++ ){
  26.  
  27. $worksheet.Cells.Item($i,$j).Text
  28. $worksheet.Cells.Item($NexRow,$j).Text
  29. $MergeCells = $worksheet.Range($worksheet.Cells.Item($i,$j), $worksheet.Cells.Item($NexRow,$j))
  30. $MergeCells.Select()
  31. $MergeCells.MergeCells = $true
  32. $MergeCells.Font.ColorIndex = 11
  33.  
  34. #$objRange.EntireColumn.AutoFit() | Out-Null
  35. }
  36. }
  37.  
  38.  
  39.  
  40. $WorkBook.Save()
  41. $objExcel.Quit()
  42.  
  43.  
  44.  
  45. `
Add Comment
Please, Sign In to add comment