Richard has attended:
Excel VBA Intro Intermediate course
VbNullString - not working??
Hi there,
I have tried using the vba function vbNullString as below,
If Range(ActiveCell) = vbNullString Then
ActiveCell.EntireRow.delete
it scans through the data, but does not identify the cells as having no data within them and therefore it does not delete the row, I have also tried:
If ActiveCell.Value. = " " Then
ActiveCell.EntireRow.delete
Again, this doesnt seem to identify empty cells and doesnt delete the row.
The data originally came from a text file - is this linked to the problem?
Any advice or a better way to do it please?
Thanks for your help.
RE: vbNullString - not working??
Hi Richard
Welcome to the joys of finding empty cells, it can be tricky.
The cells could contain spaces which would fail on the above tests.
I would try
If Trim(Activecell.Value)=vbNullString Then Activecell.EntireRow.Delete
Remember to be careful that you only need to move down a row when you do not delete a row.
Let me know how you get on.
Laura GB