View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Loop through range, Autofit height

Sheets("Sheet1".Range("AutoFit").Rows.AutoFit

Ah, yes, of course no need for the loop as I posted.

RBS


"JLGWhiz" wrote in message
...
This might work better if the named range is defined.

Sub AutoHeight()
Sheets("Sheet1".Range("AutoFit").Rows.AutoFit
End Sub





"John" wrote in message
...
This is a sub I made to loop through a range and autofit row height of
each row:

Sub AutoHeight()
Dim c As Range
For Each c In Sheet1.Range("AutoFit")
Rows.AutoFit
Next c
End Sub

The macro just keeps running and running. What;'s wrong with my sub?