View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams[_2_] Tim Williams[_2_] is offline
external usenet poster
 
Posts: 298
Default Invalid or unqualified reference error

Maybe you meant:

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

If you use a bare "." like in your ".Cells" it needs to be in the context of
a "With...End With" block.
I would also suggest qualifying the workbook for the worksheet.


Tim

"Stanley Braverman" wrote in message
...
Getting Invalid or unqualified reference error

Sub wordwrap()

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

End Sub