Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT - Formulas stopped working Edward Excel Discussion (Misc queries) 6 April 15th 09 02:13 PM
Histogram function suddenly stopped working Allisonnl09 Excel Discussion (Misc queries) 2 December 17th 08 04:17 AM
F4 Function Key stopped working Javier Excel Worksheet Functions 3 March 26th 08 07:23 PM
networkdays function stopped working Steve Excel Worksheet Functions 2 April 20th 07 02:44 PM
HELP! Button/Macro or Function has stopped working! ikcizokm Excel Programming 3 September 6th 03 08:51 PM


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"