Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a row of 0

Status
Not open for further replies.

Bvisual

Programmer
Jul 1, 2005
35
BE
I wont to check a xls file for a row with all value 0
if so the row must be deleted

waths wrong with this code and what does the bold command need to be

thx


Code:
 Dim rij As Integer = -1
            Dim kol As Integer = 1
            Do While rij < (MAX + 5)

                Dim val() As Integer = {1, 2, 3, 4, 5}
                rij = rij + 1
                val(1) = .Cells(rij, kol).value
                val(2) = .Cells(rij, kol + 1).value
                val(3) = .Cells(rij, kol + 2).value
                val(4) = .Cells(rij, kol + 3).value
                val(5) = .Cells(rij, kol + 4).value

                If val(1) + val(2) + val(3) + val(4) + val(5) = 0 Then
                    [b].rows.delete[/b]
                End If
    

            Loop
 
I would take a guess at .rows(rij).delete


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
I think this is more a question for the vba forum or try recording a macro and see what it comes up with. Thats the way I used to do it tenthousand years ago.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Only 10,000 years ago? You are obviously much younger than I thought.
 
Try this:
Code:
.Cells(rij, "A").EntireRow.Delete
Good Luck!

Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top