PDA

View Full Version : vba, how to code to select cell after certain filter field



Mawar5530
04-06-2020, 10:12 PM
Columns("H:H").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("A:AT").AutoFilter Field:=4, Criteria1:=Array( _
"POitem", "PurRqs", "ShpgNt"), Operator:=xlFilterValues
Range("F2:F" & Range("F" & Rows.Count).End(xlUp).Row).SpecialCells(12).Value = 0
Range("H2:H" & Range("H" & Rows.Count).End(xlUp).Row).SpecialCells(12).Formula = "=IF(F2=0, ABS(F2-G2),F2-G2)" (not working)
Selection.Copy
Selection.AutoFilter

Mawar5530
04-07-2020, 02:40 AM
Can someone help please

paulked
04-07-2020, 11:54 AM
It would help if you asked a question!
(not working) doesn't work for me! What isn't working? What is the error?

p45cal
04-08-2020, 04:34 AM
What's the betting column H is largely empty?
Try changing the red H below to a column letter you're sure is going to be full to the bottom of the table:
Range("H2:H" & Range("H" & Rows.Count).End(xlUp).Row).SpecialCells(12).Formula = "=IF(F2=0, ABS(F2-G2),F2-G2)" '(working)