You can do this with a formula and perhaps a macro.
I had hoped you'd give us a real example rather than this "drive other
columns" general type of thing... it saves us all a lot of time getting to
the best answer for you.
So here is my example. You want to key in a %Complete into Number1. You
want the Number1 column to drive the value of the number of bags of mortor
you need to consume on your project. So, in another custom column (say
Number2) you have the total number of bags of mortor purchased for that task.
When you enter a % in the Number1 column, it is the percentage of the bags
you believe were consumed for the task so far. You want to calculate the
number of bags remaining and display that in Number 3.
You place a formula in the Number3 field: (1-[Number1]/100)*[Number2]
Entering a value in the Number1 column drives the number in Number3.
Now, you want to limit the values in Number1 to 0...100. Can't do that with
a formula. You will need a VBA maco to run whenever the value changes and
make sure the value is within "spec." If it is not within Spec, you need to
decide what you want to do. For example, if they enter 115 do you just round
it to 100 or do you send up a message box that tells them they can't do that.
Same with negative values.
Here is some code to get you started. The challenge is handling non-numeric
data in the text1 column. I didn't try to format the Number1 column as
percent, I just did it in Text1. See if this is helpful, it runs every time
anything in the project changes.
Private Sub Project_Change(ByVal pj As Project)
Dim tsk As Task
For Each tsk In ActiveProject.Tasks
'check for blank lines
If Not tsk Is Nothing Then
If tsk.Text1 <> "" Then
'validate text1 contains a number
If IsNumeric(tsk.Text1) Then
'is the number from 0 to 100?
If tsk.Text1 >= 0 And tsk.Text1 <= 100 Then
tsk.Text1 = FormatPercent(tsk.Text1 / 100, 0)
Else
'input is numeric but out of bounds
MsgBox ("TaskID: " & tsk.ID & " must contain a numeral from 0 to 100
in Text1 field")
End If
Else
'Non numeric input in Text1
'You need to write code here on how to handle this condition
End If 'end of numeric check
End If 'check for blank text1
End If 'check for blank line
Next tsk
End Sub
--
If this post was helpful, please consider rating it.
Jim Aksel, MVP
Check out my blog for more information:
http://www.msprojectblog.com