Sub AutoSizeTable() Dim tbl As ListObject Set tbl = ActiveSheet.ListObjects('Table1') '将'Table1'替换为你的表格名称

tbl.TableStyle = 'TableStyleMedium2' '设置表格样式

'自动调整列宽
tbl.AutoFitColumns

'自动调整行高
Dim rng As Range
For Each rng In tbl.DataBodyRange.Rows
    rng.AutoFit
Next rng

End Sub

Excel VBA 代码:自动调整 L9 到 L16 表格图片大小

原文地址: https://www.cveoy.top/t/topic/mALL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录