Hi Jacob,
Thank you for taking the time to check and improve my code, it's
really
appreciated.
I didn't understand you question until i tried your code. For now, it
give
me always a zero for answer.
The value assigned to the argument "region" is the content of a cell
where
the employee select in a list the place the worked, and if it is more
than
120km from the office an amount is payed, looking in a table.
The selected place is here :
region = Sheets("Frais dépl").Range("k8")
The the amount paid is chosen in the table :
If billet = True Then
For intTemp = 21 To 29
If region = Sheets("Frais").Range("B" & intTemp) Then
autobus = Sheets("Frais").Range("E" & intTemp)
Do you understand my problem and see a solution ? For the little bit i
know,
your code is good, but maybe something is not in the right order, i
don't
know, that's why i ask.
Thanks
Inkel
"Jacob Skaria" <(E-Mail Removed)> a écrit dans
le
message de news:
1B01749A-3515-473B-B860-(E-Mail Removed)...
> Replace the autobus function with the below. I dont understand why you are
> passing the argument region if you are assigning some value within this
> function...
>
> Function autobus(billet, region)
> region = Sheets("Frais dépl").Range("k8")
> If billet = True Then
> For intTemp = 21 To 29
> If region = Sheets("Frais").Range("B" & intTemp) Then
> autobus = Sheets("Frais").Range("E" & intTemp)
> Exit For
> End If
> Next
> End If
> End Function
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>