Compile error wrong number of arguments or invald property assignment

Hank2

New Member
Joined
Aug 9, 2006
Messages
22
Am getting that compiler error on this very simple code:

Code:
Sub app()
finalrow = Cells(Rows, Count, 1).End(xlUp).Row
For x = 1 To finalrow
If Cells(x, 1) = 50 Then
Cells(x, 1).Interior.ColorIndex = 3
End If
Next x
End Sub

I wrote 10 numbers in column A including a "50" so it could turn red. I tried it on a new sheet as well and I'm can't see the problem
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,650
Office Version
  1. 365
Platform
  1. Windows
This
Code:
finalrow = Cells(Rows, Count, 1).End(xlUp).Row
should be
Code:
finalrow = Cells(Rows.Count, 1).End(xlUp).Row
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,650
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,109,522
Messages
5,529,330
Members
409,863
Latest member
stacy09
Top