Ledgers Required Code 1
Ledgers Required Code 1
' Define the starting row from which data should be fetched (e.g., 2nd
row)
StartRow = 2
' Find the last row and last column with data in the source worksheet
LastRow = SourceWorksheet.Cells(SourceWorksheet.Rows.Count,
1).End(xlUp).Row
LastColumn = SourceWorksheet.Cells(1,
SourceWorksheet.Columns.Count).End(xlToLeft).Column
' Create a new sheet in the new workbook with the same name as the
source file
Set DestSheet = NewWorkbook.Sheets.Add
DestSheet.Name = Left(SourceFileName, Len(SourceFileName) - 5) '
Removes ".xlsx" from the sheet name