Vba macro to copy row from table if value in table meets condition

后端 未结 4 1240
谎友^
谎友^ 2020-11-30 08:37

i\'m trying to make a macro which:

  1. goes through a table
  2. looks if value in column B of that table has a certain value
  3. if it has, copy that row
4条回答
  •  渐次进展
    2020-11-30 08:51

    That is exactly what you do with an advanced filter. If it's a one shot, you don't even need a macro, it is available in the Data menu.

    Sheets("Sheet1").Range("A1:D17").AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Sheets("Sheet1").Range("G1:G2"), CopyToRange:=Range("A1:D1") _
        , Unique:=False
    

提交回复
热议问题