我需要选择小于16点的所有行才能手动删除它们。以编程方式删除它们会重新缩放电子表格中的图像并将其打破(ChemBio生成的化学结构)。
我的代码会一直运行直到它做出选择:
Sub FindAndRemoveSmallRows()
Dim a As Range, b As Range, c As String
Set a = Selection
For Each b In a.Rows
If b.Height < 16 Then
c = c & b.Row & ":" & b.Row & ","
End If
Next
If Right$(c, 1) = "," Then c = Left$(c, Len(c) - 1)
Range(c).Select
End Sub
如何将字符串(例如"67:67,513:513,534:534"
)输出到Range
以便选择行?
答案 0 :(得分:1)
这可能对您有用:
Sub FindAndRemoveSmallRows()
Dim b As Range, c As Range
if typename(selection)<>"Range" then exit sub
For Each b In Selection.Rows
If b.Height < 16 Then
if c is nothing then
set c = b
else
set c = application.union(c, b)
end if
End If
Next
if not c is nothing then c.entirerow.Select
End Sub