[英]Excel macro, to copy and paste a cell value based on another cell value?
[英]VBA Excel - copy cell values and paste value in between characters of another cell
我有一个值为11的单元格,我想复制此值并将其粘贴到字符“”之间或该单元格中句子末尾的另一个单元格的另一单元格中。
即
值11位于单元格A1中,我想将其粘贴到工作表2单元格A4中的句子中: 修改频率 “ 11 ”。
在此先感谢您的帮助。
Private Sub findandreplace()
Dim string1 As String
Dim string2 As String
Dim string3 As String
string1 = ThisWorkbook.Sheets("Sheet1").Range("a1").Value
string2 = ThisWorkbook.Sheets("Sheet2").Range("a4").Value
string3 = Replace(string2, " ", string1)
ThisWorkbook.Sheets("Sheet2").Range("a4").Value = string3
Debug.Print ; string1
Debug.Print ; string2
Debug.Print ; string3
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.