VBA

H

Howard

I have a standard database which i need to upload it into my accounting
software. In this database, one column is sale amount whereby sometime the
value is NIL.

Is anyone know how to write VBA to run down that particular column to delete
those row with sale amount is NIL?

Thank you so much in advance.
 
J

Jordon

Howard said:
I have a standard database which i need to upload it into my accounting
software. In this database, one column is sale amount whereby sometime the
value is NIL.

Is anyone know how to write VBA to run down that particular column to delete
those row with sale amount is NIL?

Can you just sort by that column and delete them
manually?
 
D

Don Guillett

sub delifnil()
mc=3'column C
for i=cells(rows.count,mc).end(xlup).row to 2 step-1
if cells(i,mc)=0 then rows(i).delete
next i
end sub
 
R

Rick Rothstein

You can do this without a macro (although you will execute a single line of
code in the Immediate Window afterwards). Select the entire column and the
click Edit/Find on the menu bar. Type NIL in the "Find what" field and then
click the "Find All" button. This will select every cell the column with the
word NIL in it... leave those cells selected and go into the VB editor
(press Alt+F11) and execute this line of code in the Immediate Window...

Selection.EntireRow.Delete

That's it... this should be much faster than using a macro (especially if
there are a lot of records involved).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top