Invalid or unqualified reference error

  • Thread starter Stanley Braverman
  • Start date
S

Stanley Braverman

Getting Invalid or unqualified reference error at .Cells

Sub wordwrap()

Sheets("Sheet1").rows("1:" & .Cells(.rows.Count, "A").End(xlUp).Row).AutoFit

End Sub
 
L

Leith Ross

Stanley said:
Getting Invalid or unqualified reference error at .Cells

Sub wordwrap()

Sheets("Sheet1").rows("1:" & .Cells(.rows.Count
"A").End(xlUp).Row).AutoFit

End Sub

Hello Stanley,

The period indicates the code statement expects that the Paren
qualifier has been declared in a With statement. See below...

----------------------------------------------------
Sub wordwrap()

With Sheets("Sheet1")
.Rows("1:" & .Cells(.Rows.Count, "A").End(xlUp).Row).Autofit
End With

End Sub
---------------------------------------------------

--
Leith Ros

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top