[英]VBA Append - copy cells froma sheet to another based to a criteria
and looking to use VBA to APPEND cells from a column, to another one in another sheet. 并希望使用VBA将一列中的单元格追加到另一张工作表中。 The cells to copy Have to meet a criteria.
要复制的单元必须符合条件。
Example: 例:
Sheet name "Input":
Order Status Transaction ID
Release 90033333
Release 90055555
cancel 90077777
Release 900861515
Release 900861516
In this example only the Transaction IDs with an Order Status = "Release" will be copied after the already existent ones. 在此示例中,只有订单状态为“发布”的交易ID会在已经存在的交易ID之后被复制。
Sheet name "Output": 工作表名称“输出”:
Transaction ID
90000000
90011111
90033333
90055555
900861515
900861516
Any help with a sample code that i can start with to build my future work? 我可以从示例代码开始构建未来的工作吗?
Thank you! 谢谢!
Ok I will answer my question by myself, who knows maybe it would be helpful for someone else... 好的,我会自己回答我的问题,谁知道这可能会对其他人有所帮助...
Sub TestA()
Application.ScreenUpdating = False
Dim cell As Range
Dim OrderID As String
Dim LastRow As Long
For Each cell In Sheets("RogersEmailData").Range("A:A")
If cell.Value = "Release" Then
OrderID = cell.Offset(0, 1).Value
With Sheets("approved orders")
.Range("A" & .Rows.Count).End(xlUp).Offset(1, 0).Value = OrderID
End With
End If
Next cell
Application.ScreenUpdating = True
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.