Change the Value

K

Kleber

I'm trying to change the NewVal value after the ProjectBeforeTaskChange event
is fired.
I have created a macro that verify the input value in a column and I need to
change the value if some date criteria is not satisfied.
I can use the NewVal in the macro but not know how to change this value.
Thanks in advance
 
G

Gérard Ducouret

Kleber,

Try something like:

x = Val(NewVal)
If criteria = zzz Then
x = x * 3.14116
End if

Hope this helps,

Gérard Ducouret
 
K

Kleber

The example works. I add a MsgBox which show the new value.
But in fact I would like to insert this new value in the activecell.
For example:
I will type 2 in a cell and after the finish of the event, I will see
3.28232 in the cell.
I try to add in the code:
NewVal = x - to change the original value.
But not works.
NewVal is read-only, and used only to get the typed information that
triggered the event ?

Thanks

Kleber
 
G

Gérard Ducouret

Kleber,

Try:

ActiveCell.Task.thefield= x
where "thefield" is the field on which you are worling.
But I'm a little bit afraid by the embedded events...
Hope this helps,

Gérard Ducouret
 
K

Kleber

The problem with a embedded events occur and start a loop.
Reading a little more I understand that declaring variables "ByVal" can NOT
be changed.
If the variables in the event ProjectBeforeTaskChange was "ByRef" , problaby
the "NewVal" could be changed.
What I really wish iwas a event like "Click" for task.
This event could be called "ProjectTaskClick" and runs like other that we
can find in Forms, for example with a ComboBox.
I Think it could be very helpful.
Until this not happen I will try other approach.

Thanks for all Gérard.

Kleber
 

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