I am creating a set of csv files in VBA.
My script is creating the data set I need, but the number of rows differs in multiple iterations of the loop. For instance,
Excel saves the UsedRange. In order to truncate the UsedRange
, you need to delete whole rows and save the file.
If that's not an option, insert a new worksheet, copy the prepared data to it (thus leaving its UsedRange
matching actual data), use Worksheet.SaveAs
(as opposed to Workbook.SaveAs
) and delete the worksheet.
Although the actual problem here is why your UsedRange
gets that big in the first place.