ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formatting columns with formula results (https://www.excelbanter.com/excel-programming/344411-re-formatting-columns-formula-results.html)

Erik Creyghton[_3_]

formatting columns with formula results
 

"Mika Oukka" wrote in message
...
Hello Erik,

How about if you remove the label temporarily before autofitting:

Range("B1:D1").Select 'Assumed LabelRow = 1
For Each cell In Selection
OrigLabel = Cells(1, cell.Column).Value
Cells(1, cell.Column).Value = ""
Columns(cell.Column).EntireColumn.AutoFit
Cells(1, cell.Column).Value = OrigLabel
Next

Mika Oukka

Mika,

Yes it works, however if the label is wider than the autofit has allowed for
I run into the same problem restoring the label.

Erik




All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com