编写一段vba代码,让一个工作簿中的所有工作表都将b列升序排列
时间: 2023-03-07 19:14:18 浏览: 83
Sub SortByBColumn()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Range("A1").CurrentRegion.Sort _
Key1:=Range("B1"), Order1:=xlAscending, Header:=xlYes
Next
End Sub
相关问题
写一段Excel的VBA代码,删除一个工作簿中所有工作表里的图片
Sure, I can help you with that! Here's a VBA code to delete all the pictures in all the worksheets of a workbook:
```
Sub DeletePictures()
Dim sh As Worksheet
Dim shp As Shape
For Each sh In ThisWorkbook.Worksheets
For Each shp In sh.Shapes
If shp.Type = msoPicture Then
shp.Delete
End If
Next shp
Next sh
End Sub
```
You can simply run this code in the VBA editor of your Excel workbook, and it will delete all the pictures in all the worksheets. Let me know if you have any more questions!
写一段vba代码,把excel中所有工作簿中的图片删除
以下是 VBA 代码,可用于删除 Excel 中所有工作簿中的图片:
```
Sub DeleteAllImages()
Dim ws As Worksheet
Dim shp As Shape
For Each ws In ThisWorkbook.Worksheets
For Each shp In ws.Shapes
If shp.Type = msoPicture Then
shp.Delete
End If
Next shp
Next ws
End Sub
```
将此代码粘贴到 VBA 编辑器中,并运行它。该代码将遍历所有工作簿中的所有形状,并删除所有类型为 msoPicture 的形状,即图片。