Autofit column does not work correctly

The code below is working but it does not show all text? The sheet has a header and footer and column A is the width of the entire page.  My goal is to get the value from my userform into the sheet for printing, the text could be a sentence or multiple pages. The print button on the user form calls the sub. below is the code and have tried similar in the sheet code.

Sheets("Sheet2").Cells(3, 1).Value = TxtBackgroundContext.Value
   With Worksheets("Sheet2").Range("a3")
     Worksheets("Sheet2").Range("a3").WrapText = True
     Worksheets("Sheet2").Range("a3").HorizontalAlignment = xlLeft
     Worksheets("Sheet2").Range("a3").VerticalAlignment = xlTop
     Worksheets("Sheet2").Range("a3").Columns.AutoFit

August 8th, 2013 1:25pm

WrapText and AutoFit don't always play well together.  Excel is great, but using it as a word processor makes it a little grumpy.
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2013 1:55pm

I could not agree with you more but in my world users don't understand that.
August 8th, 2013 5:49pm

If you use wraptext then should use

Worksheets("Sheet2").Range("a3").Rows.AutoFit

as wraptext tries to wrap the text within column width it is more important use autofit on rows

Free Windows Admin Tool Kit Click here and download it now
August 9th, 2013 1:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics