在 VBA Excel 2010 中选择活动行和第一行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17285265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 15:58:11  来源:igfitidea点击:

Selecting active row and first row in VBA Excel 2010

excelvba

提问by halcyon27

How can I select the row associated with the current active cell AND the first row?

如何选择与当前活动单元格关联的行和第一行?

I have:

我有:

    Rows(ActiveCell.Row).Select
    Range("1:1").Select

But when the second "Select" is run, it removes the first select, so I end with just the first row. How to I get both selected at once?

但是当第二个“选择”运行时,它会删除第一个选择,所以我只以第一行结束。如何同时选择两者?

Thank you!

谢谢!

采纳答案by mr.Reband

 Union(ActiveCell.EntireRow, Cells(1, 1).EntireRow).Select