Excel SUBTOTAL错误

时间:2016-01-15 15:46:43

标签: excel vba

你能帮我这个宏吗? 它的自动SUBTOTAL宏,将函数放到选定列区域下的活动单元格中,但如果它处于选择状态,则宏不能正常工作。 如何在选择中跳过空白单元格。

    Dim x As String
    Dim y As String

    x = ActiveCell.Offset(-1, 0).End(xlUp).Address
    y = ActiveCell.Offset(-1, 0).Address

    ActiveCell = "=SUBTOTAL(9," & x & ":" & y & ")"
        ActiveCell.Replace What:="$", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False

谢谢

0 个答案:

没有答案