Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Round Function has stopped working - Urgent
The Round function no longer works. It fails with the
message: Wrong number of arguments or invalid property assignment. With ng help, I was given this slightly amended code: Sub TestRound2() Dim ws As Worksheet, R As Range, C As Range Dim qty As Double, rate As Double, Data As Double With ActiveSheet '.Unprotect Set C = .Range("D2") Data = C.Offset(0, 9).Value qty = C.Value rate = C.Offset(0, 2).Value If Data 0 Then If Data = 5 Then C.Offset(0, 4).Value = Round(qty * rate * Data / 100, 2) ElseIf Data = 17.5 Then C.Offset(0, 5).Value = Round((qty * rate * Data) / 100, 2) End If End If End With MsgBox Round(qty * rate * Data / 100, 2) End Sub This fails as well, if I paste it into a module in the same Project. However, if placed in a different Project (or a newly created Project), then all is well. Another routine in that same Project is now giving the same Round error message . Is there anything to resolve this, please? Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.601 / Virus Database: 382 - Release Date: 29/02/2004 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Round Function has stopped working - Urgent
You have probably declared round as a function somewhere in that project.
The local definition is taking precedence over the built in function. -- Regards, Tom Ogilvy "Stuart" wrote in message ... The Round function no longer works. It fails with the message: Wrong number of arguments or invalid property assignment. With ng help, I was given this slightly amended code: Sub TestRound2() Dim ws As Worksheet, R As Range, C As Range Dim qty As Double, rate As Double, Data As Double With ActiveSheet '.Unprotect Set C = .Range("D2") Data = C.Offset(0, 9).Value qty = C.Value rate = C.Offset(0, 2).Value If Data 0 Then If Data = 5 Then C.Offset(0, 4).Value = Round(qty * rate * Data / 100, 2) ElseIf Data = 17.5 Then C.Offset(0, 5).Value = Round((qty * rate * Data) / 100, 2) End If End If End With MsgBox Round(qty * rate * Data / 100, 2) End Sub This fails as well, if I paste it into a module in the same Project. However, if placed in a different Project (or a newly created Project), then all is well. Another routine in that same Project is now giving the same Round error message . Is there anything to resolve this, please? Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.601 / Virus Database: 382 - Release Date: 29/02/2004 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Round Function has stopped working - Urgent
Look for a sub or function in your project named Round() and rename it.
A local sub will override a VBA method. In article , "Stuart" wrote: The Round function no longer works. It fails with the message: Wrong number of arguments or invalid property assignment. With ng help, I was given this slightly amended code: Sub TestRound2() Dim ws As Worksheet, R As Range, C As Range Dim qty As Double, rate As Double, Data As Double With ActiveSheet '.Unprotect Set C = .Range("D2") Data = C.Offset(0, 9).Value qty = C.Value rate = C.Offset(0, 2).Value If Data 0 Then If Data = 5 Then C.Offset(0, 4).Value = Round(qty * rate * Data / 100, 2) ElseIf Data = 17.5 Then C.Offset(0, 5).Value = Round((qty * rate * Data) / 100, 2) End If End If End With MsgBox Round(qty * rate * Data / 100, 2) End Sub This fails as well, if I paste it into a module in the same Project. However, if placed in a different Project (or a newly created Project), then all is well. Another routine in that same Project is now giving the same Round error message . Is there anything to resolve this, please? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Round Function has stopped working - Urgent
Many thanks to you both.
That was my error. Regards and thanks. "JE McGimpsey" wrote in message ... Look for a sub or function in your project named Round() and rename it. A local sub will override a VBA method. In article , "Stuart" wrote: The Round function no longer works. It fails with the message: Wrong number of arguments or invalid property assignment. With ng help, I was given this slightly amended code: Sub TestRound2() Dim ws As Worksheet, R As Range, C As Range Dim qty As Double, rate As Double, Data As Double With ActiveSheet '.Unprotect Set C = .Range("D2") Data = C.Offset(0, 9).Value qty = C.Value rate = C.Offset(0, 2).Value If Data 0 Then If Data = 5 Then C.Offset(0, 4).Value = Round(qty * rate * Data / 100, 2) ElseIf Data = 17.5 Then C.Offset(0, 5).Value = Round((qty * rate * Data) / 100, 2) End If End If End With MsgBox Round(qty * rate * Data / 100, 2) End Sub This fails as well, if I paste it into a module in the same Project. However, if placed in a different Project (or a newly created Project), then all is well. Another routine in that same Project is now giving the same Round error message . Is there anything to resolve this, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.601 / Virus Database: 382 - Release Date: 29/02/2004 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
URGENT - Formulas stopped working | Excel Discussion (Misc queries) | |||
Histogram function suddenly stopped working | Excel Discussion (Misc queries) | |||
F4 Function Key stopped working | Excel Worksheet Functions | |||
networkdays function stopped working | Excel Worksheet Functions | |||
HELP! Button/Macro or Function has stopped working! | Excel Programming |