Inputting a value into a range of cells

P

Peter Rooney

Jack gave me a useful tip (see "Problems with filtered data") as to how I
should best filter my plan to show activities carried out by a certain team
(add a field and enter the team name into it for filtering purposes). So now,
I want to go down my plan and input the name of the team into the new text
field. I obviously don't want to type it in manually each time - rather, for
my new field, I want to select arange or tasks, then input a new value into
each "cell" (incidentally, what is the correct terminology?) in my selection.

i KNOW I should learn my object hierarchy more thoroughly but I have to set
my objectives to the end of the year today (new job - only been here three
weeks) and one of them is managing this plan - this is about the last thing I
need to do urgently, before I can give myself the luxury of actually learning
Project VBA!

Sorry to bring my life history onto the board, but you wouldn't want to see
me chucked out, would you..?

Heres the code I started with.

Sub AllTeam()
For Each InputField In ActiveSelection.Tasks
SetInputField Field:="Text5", Value:="Software Mgt"
Next
End Sub

This inputs the value into the first cell in the selction, but not the rest.

Thanks in advance

Pete
 
R

Rod Gill

Hi,

If this is a one off job then enter the value in one cell, then hold the
Ctrl key down and select cells below that will have the same value. Ctrl+D
will fill down. In Proejct Fill Down works on individual cells, they don't
have to be contiguous like in Excel.

Otherwise:
Sub AllTeam()
Dim T as Task
For Each T In ActiveSelection.Tasks
T.Text5:="Software Mgt"
Next
End Sub


--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.project-systems.co.nz/
Email rodg AT project-systems DOT co DOT nz
 
P

Peter Rooney

Hi, Rod,

Both of these solutions were handy in filling in different types of entry,
plus you solved another of my object model queries.

Thank you VERY much!

Pete
 
J

JackD

Peter,

I recommend that you take a look at my site

http://masamiki.com/project/macros.htm

and work through each of the code samples. They illustrate most of the basic
things you will want to do with the object model.
Most are pretty simple. If you can understand all the statements in them,
then you can consider yourself to have a basic understanding of how Project
VBA works and what can be done with it. From there you can start digging
into the object model for more.
 

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