Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrong Number of Arguments or Invalid Property Assignment

Status
Not open for further replies.

EliseFreedman

Programmer
Dec 6, 2002
470
GB
I am writing code to format a spreadsheet. It was working fine but now I am getting errors and I dont know why.

A typical block of code is
<code>
Range("Y20").Select
Selection.AutoFilter
Selection.AutoFilter Field:=25, Criteria1:="1"
With Columns("Z:Z").Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
Range("Z1").Select
Selection.Interior.ColorIndex = xlNone
Selection.AutoFilter
</code>

It is highlighting the line with Columns ("Z:Z").Interior
and I am getting an error about the wrong number of arguments or invalid property assignment

Any advice about what is causing this would be greatfully appreciated

Elise
 
What are the error messages you get? At a glance it looks OK so would be useful to know specifics.

Also, do you really want to format the entire column?
 
seems fine - is your worksheet protected at all ?

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 

What h as changed since it was working fine?

Have you declared a variable called Columns?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top