Cell sizing in a Vlookup formula to fit information.

G

Guest

Is it possible for a cell to automatically size itself by height to fit the
information pulled into said cell by a VLookup formula. The information in
my data table are of differing lengths. I currently have to stop working in
my spreadsheet to size the cells by height to visually see all the
information.
 
D

Dave Peterson

Could you resize all the usedrange's rowheights each time excel recalculates?

If yes, rightclick on the worksheet tab that should have this behavior. Select
view code and paste this in:

Option Explicit
Private Sub Worksheet_Calculate()
Me.UsedRange.Rows.AutoFit
End Sub

If you don't want to do all the rows, you can specify the ones you want:

Option Explicit
Private Sub Worksheet_Calculate()
Me.UsedRange.Range("a5:a12").EntireRow.AutoFit
End Sub

(It resizes 5:12 and leaves the rest alone.)
 
G

Guest

Dave, You are a genius. That was totally helpful and solved my dilema. I
thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top