May 06 2021 04:37 PM - edited May 09 2021 05:01 PM
Hi All,
I have a macro on the attached which saves information on a tab as a CSV file into a designated folder. The file path for the folder is shown on row 1, then the headings for data start on row 2.
Currently when i run the macro it will save the entire sheet, including the filepath in row 1. As this file is used as an upload into various systems, i wish to have the sheet start from row 2 (Headings), and not save row 1.
Does anyone have any suggestions on how to approach this?
Many thanks,
May 07 2021 02:20 AM
Change the lines
'Copying data to new sheet
destinationSheet.Range(destinationSheet.Cells(1, sourceStartCol), destinationSheet.Cells(sourceEndRow - sourceStartRow, sourceEndCol)).Value = sourceSheet.Range(sourceSheet.Cells(sourceStartRow, sourceStartCol), sourceSheet.Cells(sourceEndRow, sourceEndCol)).Value
to
'Copying data to new sheet
destinationSheet.Range(destinationSheet.Cells(1, sourceStartCol), destinationSheet.Cells(sourceEndRow - sourceStartRow + 1, sourceEndCol)).Value = sourceSheet.Range(sourceSheet.Cells(sourceStartRow, sourceStartCol), sourceSheet.Cells(sourceEndRow, sourceEndCol)).Value
May 09 2021 05:00 PM
May 10 2021 06:21 AM
Solution@calof1 I think the problem was that you activate the source sheet. Plus sourceStartRow should be 4.
May 10 2021 04:43 PM
May 10 2021 06:21 AM
Solution@calof1 I think the problem was that you activate the source sheet. Plus sourceStartRow should be 4.