|
本帖最后由 ggmmlol 于 2018-6-26 14:45 编辑
- Sub 批量增减行高()
- Dim h, rng As Range, cel As Range, Area As Range, nh As Single, RngAdr$, tmp, i&
- h = InputBox("请输入行高增量值", "批量增加选定区域的行高")
- h = Val(h)
- If h = 0 Then Exit Sub
- RngAdr = "," & ActiveWindow.RangeSelection.EntireRow.Address
- tmp = Split(RngAdr, ",")
- Set rng = Range(tmp(1))
- For i = 2 To UBound(tmp)
- Set rng = Union(rng, Range(tmp(i)))
- Next
- Set rng = rng.Rows
- Application.ScreenUpdating = False
- For Each Area In rng.Areas
- For Each cel In Area.Columns(1)
- nh = cel.RowHeight + h
- If nh < 0 Then nh = 0
- cel.RowHeight = nh
- Next
- Next
- End Sub
复制代码 |
|