Hi Guys,
I'm trying to Autofit a number of Rows within a macro.
I need to autofit Rows 8 to 80 as the content of these rows will have been updated by lines earlier in the macro. Some rows will now contain more than 1 line of text whereas others will now be blank.
I initially tried to use the code:
Rows("8:80").EntireRow.AutoFit
but this didn't work properly. Some rows were not as expanded as they needed to be.
I then tried to write it like this:
Sub Macro2()
Rows("8:8").EntireRow.AutoFit
Rows("9:9").EntireRow.AutoFit
Rows("10:10").EntireRow.AutoFit
Rows("11:11").EntireRow.AutoFit
Rows("12:12").EntireRow.AutoFit
End Sub
however this would take me ages to write out and would also be a pain to edit if i needed to change the rows etc.
Can anyone show me a solution to this problem and suggest why my first code did not work?
Thanks
dvent
Bookmarks