how to make it faster?

J

Joy

in my macro, I need to set Text 1 of each task ""

I use

For i = 1 To proj.Tasks.Count

proj.Tasks(i).Text1 = ""

Next

for very large files whoes number of tasks is > 50000, it is very slow to do
the update.

is it possible to have the whole column set at once? how to make it faster?
 
J

Jack Dahlgren MVP

Joy,

Performance scales exponentially with the number of tasks. See my tests
here:
http://zo-d.com/blog/archives/microsoft-project/microsoft-project-performance-limitations.html
Adding more memory or a faster processor will help.

You could try using the fill down command, write something like this:

sub fillMeDown
'select the row
'clear the first entry

SelectTaskField Row:=0, Column:="Text1", Height:=activeproject.Tasks.Count
FillDown
end sub

It took me a couple of seconds for a 5000 task example.

50000 tasks is more tasks than I'd like to work with in a single file.

-Jack Dahlgren
 
R

Rod Gill

Try recording a macro of you selecting the 50,000 cells (not the whole
column) then pressing delete.

The answer is something like:

SelectTaskField Row:=1, Column:="Text1",
Height:=ActiveProject.Tasks.Count-1, RowRelative:=False
EditClear Contents:=True


--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 

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