vba 获取同一行的第一列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11376942/
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
Get the First Column in the same row
提问by Jan
How can I find the first column same row in a Excel-sheet with vba?
如何使用 vba 在 Excel 工作表中找到第一列同一行?
I wrote a macro for finding a word in a cell an I need to get an message into the same row first column.
我写了一个宏,用于在单元格中查找单词,我需要将消息放入同一行的第一列。
Best regards
此致
回答by Siddharth Rout
Sheets("Sheet1").Cells(aCell.Row,1)
Where aCell
is the range which has the word which your searched
aCell
您搜索的单词所在的范围在哪里
Alternatively, you can also use this
或者,您也可以使用此
Sheets("Sheet1").Range("A" & aCell.Row)
回答by Jean-Fran?ois Corbett
aCell.Offset(0, -aCell.Column + 1).Value = "This is my message."
回答by chris neilsen
To avoid the need to know the sheet name, use
为避免需要知道工作表名称,请使用
aCell.EntireRow.Cells(1,1)