View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_769_] Leith Ross[_769_] is offline
external usenet poster
 
Posts: 1
Default Invalid or unqualified reference error


Stanley Braverman;260814 Wrote:
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 Stanely,

You can write this a couple of ways:
---------------------------------------------------------------
Sheets("Sheet1").rows("1:" & Sheets("Sheet1").Cells(Rows.Count,
"A").End(xlUp).Row).AutoFit

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


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=72780