Forum Discussion
KristelNulens
Dec 07, 2022Copper Contributor
Deleting blank records with macro
I need some help with the attached macro. I don't know how many records the files, on which I will be running this macro, will have. For that reason I wrote the code to auto-populate columns I (=...
Zach Prins
Dec 07, 2022Brass Contributor
Hi Kristal,
Eliminating the loop will make the code much faster.
You can do that by using SpecialCells. I would also make the range dynamic by looking at the number of rows used for each file.
You can replace your loop with one line of code:
Range("C2:C" & UsedRange.Rows.Count).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Regards,
Zach
Eliminating the loop will make the code much faster.
You can do that by using SpecialCells. I would also make the range dynamic by looking at the number of rows used for each file.
You can replace your loop with one line of code:
Range("C2:C" & UsedRange.Rows.Count).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Regards,
Zach
KristelNulens
Dec 13, 2022Copper Contributor
Thanks!