首页 > 解决方案 > 在 Excel 中为图表选择数据时跳过行的语法是什么?

问题描述

编辑:移动数据以使自己更清楚,并意识到我的问题不正确且不够彻底。

我试图在 Excel 中为图表选择数据时传递两行。我需要从 JN 列中选择,但从 KN 中,我需要跳过第 2-3 行。F 是 X 轴。您如何在 Excel 中制定除第 2-3 行之外的所有列 J 和所有列 KN 的公式?

=Sheet1!$F$1:$F$113,Sheet1!$J$1:$N$113

标签: excelvba

解决方案


Try this basic macro...it will copy Col J, then hide Rows 2 & 3 and copy cols K:N visible cells only. Adjust the source and destination to suit your needs.

With ThisWorkbook.Sheets("Sheet1")
    .Columns("J").SpecialCells(xlCellTypeVisible).Copy _
    Destination:=Sheet2.Range("A1")

    .Range("A2:A3").EntireRow.Hidden = True
    .Columns("K:N").SpecialCells(xlCellTypeVisible).Copy _
    Destination:=Sheet2.Range("B1")
End With

推荐阅读