[英]Excel 2010: When Cell B1 clicked add contents of adjacent cell (A1, or C1) to another cell
I'm developing an Excel document for my own use, but I've hit a wall in getting everything to work as I want it, I don't really know much VBA, but I understand I'll probably require it to get what I want working... :)我正在开发一个 Excel 文档供我自己使用,但是我在让一切按我想要的方式工作方面遇到了困难,我不太了解 VBA,但我知道我可能需要它来获得什么我想工作... :)
What I need is, for example, when cell B1 is clicked, I want Excel to take the contents of an adjacent cell, (it could be A1 or C1), and duplicate / paste / copy it into the next blank cell of a row in another sheet .我需要的是,例如,当单击单元格 B1 时,我希望 Excel 获取相邻单元格的内容(可能是 A1 或 C1),并将其复制/粘贴/复制到一行的下一个空白单元格中在另一张纸上。
I'd preferably like it to be flexible, so that I can simply duplicate it for B2 (and it would then apply for A2 or C2), since it would be required for hundreds of cells - and entering it manually constantly would be a total pain.我希望它灵活一些,这样我就可以简单地将它复制到 B2(然后它将适用于 A2 或 C2),因为数百个单元格都需要它 - 并且不断地手动输入它是一个总数疼痛。 I don't really want to use forms or check boxes...
我真的不想使用 forms 或复选框...
Thanks,.谢谢,。 Luke.
卢克。
Maybe I misunderstood your question but I'd go about it like this:也许我误解了你的问题,但我想 go 是这样的:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim WS As Worksheet: Set WS = Worksheets(2)
Dim adjacent As Range: Set adjacent = Target.Offset(0, 1)
WS.Range(adjacent.Address).Value = adjacent.Value
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.