小编Pau*_*ird的帖子

差不多了!如何通过整数隐藏行?

我试图在这个基于单元格输入的简单示例中通过整数计数隐藏Excel中的行.我似乎无法为Application.Rows("x:x")选择命令获得正确的语法.

这是我的示例代码:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim i As Integer
Dim k As Integer

For k = 0 To 1

    i = 2 + k * 20

    If Target.Column = 9 And Target.Row = i And Target.Value = "" Then
        Application.Rows("[i+4]:[i+12]").Select
        Application.Selection.EntireRow.Hidden = True
    Else
        Application.Rows("[i+4]:[i+12]").Select
        Application.Selection.EntireRow.Hidden = False
    End If

    If Target.Column = 9 And Target.Row = i And Target.Value = "1" Then
        Application.Rows("[i+7]:[i+12]").Select
        Application.Selection.EntireRow.Hidden = True
    End If

    If Target.Column = 9 And Target.Row = i …
Run Code Online (Sandbox Code Playgroud)

vba integer

3
推荐指数
1
解决办法
65
查看次数

标签 统计

integer ×1

vba ×1