简体   繁体   English

双击将单元格值复制到另一个单元格

[英]Copy cell value to another cell on double-click

I need VBA code in Excel. 我需要Excel中的VBA代码。 If I double-click a cell in E-or-F-or-G column, the displaying value should be copied in corresponding H cell. 如果我在E-或-F-或-G列中双击一个单元格,则显示值应复制到相应的H单元格中。 Please advise, I am new user. 请告知,我是新用户。

       E       F       G      H
1   1.00    0.50    0.00     
2   1.00    0.50    0.00     
3   1.00    0.50    0.00    

Not tested: 未经测试:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

if Target.Column>=5 and Target.Column<=7 then
 Cells(Target.Row,8)=Target.Value
endif

End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM