how to delete rows in a macro?

B

Bjørn Tore Hovda

Here is my code:

For Each tskT In ActiveProject.Tasks

If Mid$(tskT.Text18, 1, 3) = "del" Then
MsgBox ("sletter: " & tskT.Text17)
SelectRow Row:=tskT.ID, RowRelative:=False
EditDelete
End If

Next tskT

Her is my problem:

Hey , i got this problem at work. im trying to scan trew a column (text18)
and delete all tasks who contains the substring "del".
i think i got this if-sentence working. my problem is the selectrow row:=
tskt.ID and the rowrelative:= false thing. what is it? :)

and is there anybody who can show me a simple way to scan trew a column and
delete SEVERALE rows?

thanks

Bjørn Tore
 
J

JackD

Bjorn,

You do not need to select the row to delete the task. Reference the task
directly.

Try this

For Each tskT In ActiveProject.Tasks
If Mid$(tskT.Text18, 1, 3) = "del" Then
tskT.delete
End If
Next tskT

This will delete all of the tasks that fit your criteria. It will delete
several rows at once.

-Jack
 
B

Bjørn Tore Hovda

thanks!!!!



JackD said:
Bjorn,

You do not need to select the row to delete the task. Reference the task
directly.

Try this

For Each tskT In ActiveProject.Tasks
If Mid$(tskT.Text18, 1, 3) = "del" Then
tskT.delete
End If
Next tskT

This will delete all of the tasks that fit your criteria. It will delete
several rows at once.

-Jack
 

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