[英]VBA Macro - Copy Partial Row from Below Based on Cell Value
I'm really new to VBA and trying to figure out how to create a loop so that, when the value in column A is “1”, the values from columns E to N in the row immediately below are copied to the row above (without inserting a new row, just pasting over the existing values). 我真的是VBA的新手,试图弄清楚如何创建一个循环,以便当A列中的值为“ 1”时,将紧接在下一行的E到N列的值复制到上一行(无需插入新行,只需粘贴现有值即可)。 I've been through the course book and dozens of Excel forums and can't see a way of doing this?
我已经看过课程书和数十个Excel论坛,看不到这样做的方法吗? Is it possible?
可能吗?
Thanks, Adam 谢谢亚当
Something like this should work 这样的事情应该工作
Sub test()
Dim n as Integer
Dim i As Integer
n = 100
For i = 1 To n
If CInt(Range("a" & i)) = 1 Then
Range("e" & i + 1 & ":n" & i + 1).Copy
Range("e" & i).PasteSpecial xlPasteValues
End If
Next i
Application.CutCopyMode = False
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.