[英]Copy and paste a range of cell values into another sheet with VBA and using Offset
[英]Excel VBA - Search Range - If Cell Contains Text Then Copy Cell - Paste Offset 2,1
我正在嘗試簡化每周使用的Excel工作表。
我正在嘗試創建將執行以下操作的VBA宏:
任何人能給我的任何幫助,我將不勝感激。 我搜索了其他宏,並試圖對其進行修改以供使用,但無濟於事。
**Example Before Macro**
A B C D E
1 Hi
2 Test
3
4 Done
5
6
**Example After Macro Has Been Run**
A B C D E
1 Hi
2 Test
3 Hi
4 Done Test
5
6 Done
當前代碼:
Sub CopyC()
Dim SrchRng As Range, cel As Range
Set SrchRng = Range("C1:C10")
For Each cel In SrchRng
If InStr(1, cel.Value) > 0 Then
cel.Offset(2, 1).Value = "-"
End If
Next cel
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.