I need to auto fit the visible columns with the data after the data are imported. I tried to use this:
and this
But what the code does is makes all the visible columns with data standard size rather auto fit them to the widest cell. I wonder what I am doing wrong?
VBA Code:
ActiveSheet.Cells.SpecialCells(xlCellTypeVisible).Columns.AutoFit
and this
VBA Code:
ActiveSheet.Cells.SpecialCells(xlCellTypeVisible).EntireColumn.AutoFit
But what the code does is makes all the visible columns with data standard size rather auto fit them to the widest cell. I wonder what I am doing wrong?