我希望这段代码能够遍历工作簿中的所有工作表。最简单的方法是什么?
我的代码:
Sub tableformat()
' tableformat Macro
' formats error by provider tables
'
' Keyboard Shortcut: Ctrl+s
'
Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Selection.RowHeight = 15
ActiveCell.FormulaR1C1 = "service_id"
Columns("E:E").Select
Columns("C:C").ColumnWidth = 59.86
Columns("C:C").ColumnWidth = 87.43
Columns("C:C").ColumnWidth = 112.57
Columns("C:C").ColumnWidth = 108.29
Columns("D:D").ColumnWidth = 21.43
Columns("D:D").ColumnWidth = 16.57
Columns("D:D").Select
Selection.Style = "Currency"
Rows("1:1").Select
Selection.Font.Bold = True
Columns("A:E").Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A1:$E" & Lastrow), , xlYes).Name = _
"Table2"
Columns("A:E").Select
ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleMedium2"
Range("C16").Select
End Sub