[英]Excel VBA - Search Range - If Cell Contains Text Then Copy Cell - Paste Offset 2,1
I'm attempting to simplify an excel sheet I work with on a weekly basis. 我正在尝试简化每周使用的Excel工作表。
I'm trying to create a VBA Macro that would do the following: 我正在尝试创建将执行以下操作的VBA宏:
Any help anyone can give me, I would greatly appreciate. 任何人能给我的任何帮助,我将不胜感激。 I have searched for other macros and have attempted to modify them for my use to no avail.
我搜索了其他宏,并试图对其进行修改以供使用,但无济于事。
**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
Current Code: 当前代码:
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.