JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,900
- Office Version
-
- 365
- Platform
-
- Windows
Hi,
I have 103 files all in the same folder, each file is approximately 30kb in size and contains 5 or less worksheets.
Task for each worksheet in each file is:
If A1 is not empty then delete each empty cell (entire row) found in column B (column A will define the last row position).
I wish to write a macro that is faster than using a nested loop and cycling through each sheet per file:
(Aware this is pseudo code, for purposes of posting question only)
One possible issue with Specialcells is there may be invisible characters in column B so my test may need to change to any cell in column B where length of cell contents < 2
Would an ADO connection be able to read and write/edit these files faster than having to open and close each one? I thought ADO connections were suitable for .csv files only or connecting to a database.
Any thoughts/comments/suggestions very welcome.
TIA,
Jack
I have 103 files all in the same folder, each file is approximately 30kb in size and contains 5 or less worksheets.
Task for each worksheet in each file is:
If A1 is not empty then delete each empty cell (entire row) found in column B (column A will define the last row position).
I wish to write a macro that is faster than using a nested loop and cycling through each sheet per file:
Rich (BB code):
For Each file in Folder
Open file
For Each worksheet in opened file
If worksheet.A1 <> "" Then
LR = cells(rows.count, 1).end(xlup).row
cells(3, 2).resize(LR-2).Specialcells(xlcelltypeblanks).entirerow.delete 'Separate reason to ignore row 2 and start at B3)
End If
Next worksheet
Next file
One possible issue with Specialcells is there may be invisible characters in column B so my test may need to change to any cell in column B where length of cell contents < 2
Would an ADO connection be able to read and write/edit these files faster than having to open and close each one? I thought ADO connections were suitable for .csv files only or connecting to a database.
Any thoughts/comments/suggestions very welcome.
TIA,
Jack
Last edited: