简体   繁体   English

VBA附加-根据条件将单元格从一张纸复制到另一张纸

[英]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.

相关问题 VBA-根据多个条件从另一张纸复制单元格 - VBA - copy cells from another sheet based on multiple criteria VBA将符合条件的单元格复制到另一张工作表 - VBA copy cells that meet criteria to another sheet 通过根据条件覆盖另一个工作表中的单元格来复制单元格和粘贴 - Copy cells and paste by overwriting cells in another sheet based on a criteria 根据另一列中的条件将一列中的单元格复制到另一张工作表 - Copy Cells in One Column, Based on Criteria in Another Column, to Another Sheet 根据另一个单元格中的条件将单元格从一个工作表复制到另一个工作表 - Copy cells from one sheet to another based on criteria in another cell 根据多个单元格中的条件将一行中的单元格(不是整行)复制到另一个工作表 - Copy cells in a row (not entire row) based on criteria in multiple cells to another sheet Excel VBA根据条件从一张纸复制到另一张纸的特定单元格 - Excel VBA copy from one sheet to other sheets specific cells based on criteria VBA将满足条件的行复制到另一个工作表 - VBA copy rows that meet criteria to another sheet Excel - 根据没有 VBA 的条件将行从一个工作表复制到另一个工作表 - Excel - Copy rows from one sheet to another sheet based in a criteria without VBA VBA代码可根据条件复制特定列中的单元格并将其粘贴(值)到另一张工作表中特定列中的单元格 - VBA code to copy cells in specific column and paste (value) it to cells in specific column on another Sheet based on conditions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM