MrClueless
New Member
- Joined
- May 29, 2013
- Messages
- 8
This is a portion of a Macro that I am creating. What this portion of the macro does is filters column D based on "Piece Quantity" and Clear Contents in Column D and Column H. Column H contains data that corresponds with Piece Quantity and needs to be removed as well. The Problem that I am running into is in when it selects a specific cell, in this case Range("D471"). The problem is that this macro will be used on a weekly basis and the data is always changing so D471 will not always be the first row in column D after the spreadsheet has been filtered. Is it possible to have the macro look at Column D and find the first row containing Piece Quantity. The rest of the macro is working fine.
Windows("PieceRateRPT_060913_800AM.xlsx").Activate
Selection.AutoFilter
ActiveSheet.Range("A:P").AutoFilter Field:=4, Criteria1:= _
"Piece Quantity"
Range("D471").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.AutoFilter
Windows("PieceRateRPT_060913_800AM.xlsx").Activate
Selection.AutoFilter
ActiveSheet.Range("A:P").AutoFilter Field:=4, Criteria1:= _
"Piece Quantity"
Range("D471").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.AutoFilter