我对宏很陌生,但我正在尝试过滤列 AW,然后在列 AZ 中输入与该条件相对应的文本。当然,我想将该文本填写到可见单元格中,然后使用在 AZ 列中过滤的其他条件重复该过程。我正在使用下面的编码,但它没有填写 AZ 列,仅在 AZ2 中!我不希望标题受到影响。在这里感谢任何帮助!-艾米
Sub Macro16()
' Macro16 Macro
'Insert Column - OK
Columns("AZ:AZ").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("AZ1").Select
ActiveCell.FormulaR1C1 = "Finalized Comment"
Rows("1:1").Select
Range("AS1").Activate
Selection.AutoFilter
'Filter Combined Comment for #NA then type "Style linked to a Dropped T/P"
Dim lastRow As Long
With ActiveSheet
.Range("AW2").AutoFilter Field:=2, Criteria1:="#N/A"
lastRow = .Range("AW" & Rows.Count).End(xlUp).Row
.Range(.Range("AZ2"), .Range("AZ" & lastRow)). _
SpecialCells(xlCellTypeVisible).Value = _
"Style Linked to a Dropped T/P"
End With
'Filter Combined Comment for "Confirmed Cost and Missing HTS Code" then =Combined Comment
Dim lastRow As Long
With ActiveSheet
.Range("AW2").AutoFilter Field:=2, Criteria1:="Confirmed Cost and Missing HTS Code"
lastRow = .Range("AW" & Rows.Count).End(xlUp).Row
.Range(.Range("AZ2"), .Range("AZ" & lastRow)). _
SpecialCells(xlCellTypeVisible).Value = _
"Confirmed Cost and Missing HTS Code"
End With
'Filter Combined Comment for "Unconfirmed Cost and HTS Code Present" then =Unconfirmed Cost
Dim lastRow As Long
With ActiveSheet
.Range("AW2").AutoFilter Field:=2, Criteria1:="Unconfirmed Cost and HTS Code Present"
lastRow = .Range("AW" & Rows.Count).End(xlUp).Row
.Range(.Range("AZ2"), .Range("AZ" & lastRow)). _
SpecialCells(xlCellTypeVisible).Value = _
"Unconfirmed Cost"
End With
'Filter Combined Comment for "Unconfirmed Cost and Missing HTS Code" then =Missing HTS
Dim lastRow As Long
With ActiveSheet
.Range("AW2").AutoFilter Field:=2, Criteria1:="Unconfirmed Cost and Missing HTS Code"
lastRow = .Range("AW" & Rows.Count).End(xlUp).Row
.Range(.Range("AZ2"), .Range("AZ" & lastRow)). _
SpecialCells(xlCellTypeVisible).Value = _
"Missing HTS Code"
End With
End Sub