Forum Discussion
VBA language macro
- Apr 05, 2023
Hi Hans,
Thank you for answering me, the macro that I am doing is used to determine the monetary charge that must be made to the users of the wastewater treatment plants when their contamination levels are higher than those allowed by the authority.
Once the contamination value of each of the parameters that must be met is known, a non-compliance index is established and, depending on the non-compliance index, it is the charge in money.
The ranges will be for example
0.1<= Index >0.5
0.5 <= Index < 1
Etc
You declare VarSed as a variable of type Single. The line
VarSed.Formula = "=((E4-E3)/1000)*B4*1.71"
expects VarSed to be a variable of type Range, not of type Single. Also, the line
ElseIf 0.1 <= VarSed < 0.5 Then
should be
ElseIf VarSed < 0.5 Then
and similar for the other ElseIf lines except for the last one. The line
VarSed = Application.Sheets("Cargo por tratamiento").Range("U4:U24").Value
won't work either, since the value of a multi-cell range is an array of values.
What exactly do you want the macro to do?
- Octavio_RamosMy_usernApr 05, 2023Copper Contributor
Hi Hans,
Thank you for answering me, the macro that I am doing is used to determine the monetary charge that must be made to the users of the wastewater treatment plants when their contamination levels are higher than those allowed by the authority.
Once the contamination value of each of the parameters that must be met is known, a non-compliance index is established and, depending on the non-compliance index, it is the charge in money.
The ranges will be for example
0.1<= Index >0.5
0.5 <= Index < 1
Etc- HansVogelaarApr 05, 2023MVP
Which cell or cells should contain the formula?
(Why did you mark your own reply as the answer?)
- Octavio_RamosMy_usernApr 05, 2023Copper Contributor