为工作簿中的每个工作表运行vb代码

我想调整此代码,以便它: – replace所有图像与他们的AlternativeText – 运行工作簿中的所有工作表

Dim Pic As Picture Dim Cell As Range For Each Pic In ActiveSheet.Pictures Set Cell = Pic.TopLeftCell.Offset(, -1) Do If Cell.Value = "" Then Cell.Value = Pic.ShapeRange.AlternativeText Exit Do Else Set Cell = Cell.Offset(1) End If Loop Next Pic End Sub 

你能和我一起考虑这个吗? 提前非常感谢!

要遍历工作簿中的所有工作表,请使用:

 For s = 1 to ActiveWorkbook.Worksheets.Count Sheets(s).Activate 'Enter code to be run on each worksheet here Next s