Cost rate change.....

V

Vit

Hi All,

I have to write some VBA code to automatically increase (or decrease)
the coste rate....

when I read the value with the following, I have to store it as a
string, so if I'd like to increase it of 10%, i'm not able:

ActiveProject.Resource.CostRateTables("A").PayRates(1).StandardRate

How can I increase it by a percentage????

any other sugestion???

I'd like to automatically increase the value of the the cost rate of a
right percentage...

thanks all

Vit
 
J

John

Vit said:
Hi All,

I have to write some VBA code to automatically increase (or decrease)
the coste rate....

when I read the value with the following, I have to store it as a
string, so if I'd like to increase it of 10%, i'm not able:

ActiveProject.Resource.CostRateTables("A").PayRates(1).StandardRate

How can I increase it by a percentage????

any other sugestion???

I'd like to automatically increase the value of the the cost rate of a
right percentage...

thanks all

Vit

Vit,
This may be an obvious detail, but the line of code you show will not
work. It needs to be something like:
ActiveProject.Resources(1).CostRateTables("A").PayRates(1).StandardRate

The following code will give you what you need:
Sub RateEscalate()
Dim r As Resource
For Each r In activeproject.Resources
ResRat = r.CostRateTables("A").PayRates(1).StandardRate
conv = Mid(ResRat, 2, InStr(1, ResRat, "/") - 2)
r.CostRateTables("A").PayRates(1).StandardRate = conv * 1.1
Next r
End Sub

John
Project MVP
 
R

Rod Gill

Hi,

The following works:

Sub test()
Dim Rate As Currency
Dim Res As Resource
Dim str As String
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
str = Res.CostRateTables("A").PayRates(1).StandardRate
Rate = Val(Mid(str, 2))
Res.CostRateTables("A").PayRates.Add Date, Rate * 1.1 &
Right(str, 2)
End If
Next Res
End Sub

The code handles resources on different rate timescales (EG /d or /h).

--

Rod Gill
Microsoft MVP for Project

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

Vit

Thanks Rod and John...

very happy with this solution....

just one question.... what about if I insert a rate for month????
should be $100.00/Mo.... right??? (because "/m" should be minutes....)

in this case it will work??? I'm not sure......

thank again

Vit
 
R

Rod Gill

That would work with my code, but it's not recommended as Months in Project
are just 20 working days. it is more accurate to use h, d, w or y

--

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