Hi Team,
I am able to copy multiple sheets into single sheet but getting two issues with it.
1. Formatting of the source sheet is not getting preserved in the destination sheet.(Column B and C in the source sheet is having different width but in destination its not coming)
2. I want to copy the header from the first sheet and from second sheet onwards i want to copy the date f from row 2.
Below is the code which i have used
Can you please send me the updated code for this?
Dim filePath As String = “\ysiinvgs3\Reports70rel\Demo\TEMP\InvestTS_REPORT.xls”
Dim workbook As Workbook = New Workbook(filePath)
Dim destWorkbook As Workbook = New Workbook()
Dim destSheet As Worksheet = destWorkbook.Worksheets(0)
Dim TotalRowCount As Integer = 0
For I = 0 To workbook.Worksheets.Count - 1
Dim sourceSheet As Worksheet = workbook.Worksheets(I)
Dim sourceRange As Range = sourceSheet.Cells.MaxDisplayRange
Dim destRange As Range = destSheet.Cells.CreateRange(sourceRange.FirstRow + TotalRowCount, sourceRange.FirstColumn, _
sourceRange.RowCount, sourceRange.ColumnCount)
destRange.Copy(sourceRange)
TotalRowCount = sourceRange.RowCount + TotalRowCount
Next
destWorkbook.Save("\ysiinvgs3\Reports70rel\Demo\TEMP\oUTPUT.xls")