I have an excel sheet where it uses a scroll bar to show data, this data changes with the scroll bar, some fields don’t show all the data. I’d like to have it where the data when it shows in the rows in question auto re-size as required. As the data goes up or down the list the row will auto-size so where it was goes back to a smaller size, and the row above or below depending the way the scroll bar is moved, will be adjusted to accomidate the larger data in the cell.
I wrote this code in the worksheet in question thinking it would work, but it doesn’t…
Option Explicit
Private Sub Workbook_Open()
Rows("2:12").EntireRow.AutoFit
Loop
End Sub
Now what I’d like to see is which is a caveat is the cells won’t go under a specific height, which is 36. It is just a want, but I’d like to see it kept that way… so it stays unformed, minus the cell that needs to expand to show more data.
First of all, name the workbook and sheet on which you want to apply the autofit.
Eg.
And uhm, why the loop?
For putting limits on the row heights, check out this thread: http://www.ozgrid.com/forum/showthread.php?t=19813