如何将一系列单元格值附加到已包含文本的单元格的末尾 [英] How can I APPEND a range of cell values to the end of cells that already contain text

查看:80
本文介绍了如何将一系列单元格值附加到已包含文本的单元格的末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止我有这个,我知道第一个复制和粘贴正在工作,但我无法弄清楚如何将我在第二行到最后一行复制的文本附加到现有的末尾单元格中的文字位于最后一行:

I have this so far, and I know that the first copy and paste is working, but I cannot figure out how to append the text that I copy in the second to last line, onto the ends of the existing text in the cells range on the last line:

Sub MacroCopyPaste()

Sub MacroCopyPaste()

谢谢,

Thanks,

Andrea

推荐答案

你好Andrea:

Hello Andrea:

这是我相信的代码是什么你要求:

Here is code that I believe is what you requested:

Option Explicit

Sub MacroCopyPaste()
Dim wkbMyWorkbook As Workbook
Dim wksSheet1 As Worksheet
Dim rngSourceOfAppend As Range
Dim C As Range

Set wkbMyWorkbook = ThisWorkbook
Set wksSheet1 = wkbMyWorkbook.Sheets("Sheet1")

Set rngSourceOfAppend = wksSheet1.Range("B18:B85")
wksSheet1.Range("D10").Copy
wksSheet1.Range("F18:F85").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    
For Each C In rngSourceOfAppend
    C.Offset(0, 4).Value = C.Offset(0, 4).Value & C.Value
Next C

wksSheet1.Cells(1, 1).Select
        
End Sub

首先,它取D10中的值,然后在F18:F85的范围内填充它。  然后,它采用范围B18:F85中的值,并将这些单元格中的值附加到F18:F85中的值。  如果那不是你所需要的,请告诉我。

First, it take the value in D10 and then populates it in the range of F18:F85.  Then, it takes the values in range B18:F85 and appends the values in those cells to the values in F18:F85.  If that's not what you need, please let me know.

问候,


这篇关于如何将一系列单元格值附加到已包含文本的单元格的末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆