简体   繁体   English

VBA Excel-复制单元格值并将值粘贴在另一个单元格的字符之间

[英]VBA Excel - copy cell values and paste value in between characters of another cell

I have a cell with value 11 and i want to copy this value and paste it in another cell (of another sheet) between characters "" or at the end of the sentence within the cell. 我有一个值为11的单元格,我想复制此值并将其粘贴到字符“”之间或该单元格中句子末尾的另一个单元格的另一单元格中。

ie

the value 11 is in cell A1 and i want to paste it in sheet 2 cell A4 in the sentence : modify frequency " 11 ". 11位于单元格A1中,我想将其粘贴到工作表2单元格A4中的句子中: 修改频率11 ”。

thanks in advance for any help. 在此先感谢您的帮助。

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.

相关问题 Excel宏,要基于另一个单元格值复制和粘贴单元格值? - Excel macro, to copy and paste a cell value based on another cell value? 如何将公式驱动的单元格复制并粘贴到另一个单元格中作为Excel中的值 - How to copy and Paste a formula driven cell to another cell as values in Excel Excel VBA - 基于单元格值在VBA中复制和粘贴循环 - Excel VBA - Copy and Paste Loop in VBA based on cell value VBA - 将字符串中的字符拆分,复制并粘贴到另一个单元格中(具有条件) - VBA - Split, copy and paste characters from string into another cell (with conditions) Excel VBA从列复制值并将值粘贴到单元格中 - excel vba copy value from a column and paste value in a cell Excel VBA - 将每个单元分别复制并粘贴到另一个程序 - Excel VBA - Copy and Paste each cell Individually to another program Excel VBA复制/粘贴范围到另一个工作表中的下一个可用单元格 - Excel VBA Copy/Paste Range to the next available cell in another worksheet Excel VBA将特定的单元格复制并粘贴到另一个工作表 - Excel VBA copy and paste a specific cell to another Sheet Excel VBA:从另一个工作簿循环中复制和粘贴特定单元格 - Excel VBA: Copy and Paste Specific Cell from Another Workbook Loop Excel VBA:在特定单元格中设置值,然后复制一组单元格并粘贴值,然后迭代该值 - Excel VBA: Set a value in a specific cell, then copy a set of cells and paste values, then iterate the value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM