有人可以让我知道如何在一行中写下面两组代码(每组代码)吗?将多行VBA代码压缩并合并到一行
newb.sheets("Sheet1").Cells.EntireColumn.AutoFit
newb.sheets("Sheet2").Cells.EntireColumn.AutoFit
newb.sheets("Sheet3").Cells.EntireColumn.AutoFit
newb.sheets("Sheet4").Cells.EntireColumn.AutoFit
LastRow1 = sheets("Sheet1").Range("A1000000").End(xlUp).Row
LastRow2 = sheets("Sheet2").Range("A1000000").End(xlUp).Row
LastRow3 = sheets("Sheet3").Range("A1000000").End(xlUp).Row
LastRow4 = sheets("Sheet4").Range("A1000000").End(xlUp).Row
为什么它需要在一条线上?并且功能/子呼叫计为一条线吗? –
因为我有28张工作簿。所以会有28行代码。因此,我正在寻找一种减少线数的最佳方法。我只是想成为一个最好,最聪明的程序员。 – vbalearner
也许你应该为了清晰起见添加这个问题,尽管@SivaCharan和simpLEMAn似乎明白它...... :) –