Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Office > Project

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-02-2019, 07:28 AM
ThinAirDesigns ThinAirDesigns is offline Windows 10 Office 2003
Novice
 
Join Date: Sep 2018
Posts: 5
ThinAirDesigns is on a distinguished road
Default Looping backwards through a 'For Each' collection

Here is the usual VBA code for looping through all tasks in Projects:

For Each t In ActiveProject.Tasks


{code for desired action}
Next t

This loops through from the top down (as far as I can tell).

Anyone have any ideas as to how I can reverse this and go from the bottom up?

Thanks
JB
Reply With Quote
  #2  
Old 05-02-2019, 02:16 PM
ThinAirDesigns ThinAirDesigns is offline Windows 10 Office 2003
Novice
 
Join Date: Sep 2018
Posts: 5
ThinAirDesigns is on a distinguished road
Default

Solved (with all credit to Tom Boyle)

Sub BackTasks()
Dim t As Task

Dim i As Long

For i = ActiveProject.Tasks.Count To 1 Step -1

Set t = ActiveProject.Tasks(i)

If Not t Is Nothing Then

'Your Code Here

End If

Next i

End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
site collection is inaccurate dbsoccer51 Misc 0 12-02-2015 03:30 PM
Upgrading backwards !!! Soporose Office 1 09-23-2014 02:04 AM
how to calculate backwards from a set finish date ketanco Project 1 02-07-2013 06:50 AM
Backwards Searching Using a Formula OTPM Excel 5 05-17-2011 09:17 AM
Visio 2002 backwards compatible with 2000 franklyorange Visio 0 11-17-2008 11:00 AM


All times are GMT -7. The time now is 10:43 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft