ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error Message in Loop (https://www.excelbanter.com/excel-programming/346677-error-message-loop.html)

Joe Fish

Error Message in Loop
 
Hi,
I'm trying to soup up a loop I have, but I'm getting the following
error message:

Wrong Number of Arguments or Invalid Property Assignment

I've been through Help and The Books, but I can't determine what's
wrong.

Thanks,
Joe

Sub MOO()

Dim rng As Range
Set rng = Range(ActiveCell, ActiveCell.End(xlDown))

j = 0

For Each cell In rng
If cell.Value < cell.Offset(-1).Value Then
CreatePSFrontLabel cell, j
j = j + 1
End If
Next

End Sub


Jezebel[_3_]

Error Message in Loop
 
Offset() takes two arguments, and you're giving it only one.


"Joe Fish" wrote in message
oups.com...
Hi,
I'm trying to soup up a loop I have, but I'm getting the following
error message:

Wrong Number of Arguments or Invalid Property Assignment

I've been through Help and The Books, but I can't determine what's
wrong.

Thanks,
Joe

Sub MOO()

Dim rng As Range
Set rng = Range(ActiveCell, ActiveCell.End(xlDown))

j = 0

For Each cell In rng
If cell.Value < cell.Offset(-1).Value Then
CreatePSFrontLabel cell, j
j = j + 1
End If
Next

End Sub




Joe Fish

Error Message in Loop
 
Actually, you can offset with one argument. The part of the code that
gets highlighted in the error message is the macro (CreatePSFrontLabel
).


JE McGimpsey

Error Message in Loop
 
Nope. Both arguments of Offset() are optional.

I suspect you have the wrong number or type of arguments for your
CreatePSFrontLabel procedure.


In article ,
"Jezebel" wrote:

Offset() takes two arguments, and you're giving it only one.



All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com