Excel Macro to Access Query (1 Viewer)

crownedzero

Registered User.
Local time
Today, 13:46
Joined
Jun 16, 2009
Messages
54
Code:
Sub Remove_NoStock()
Dim i As Long
Application.ScreenUpdating = False
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
    If Cells(i, 3) = "D" And _
    Application.WorksheetFunction.SumIf(Range("A:A"), Cells(i, 1), Range("G:G")) = 0 Then
        Cells(i, 1).EntireRow.Delete
    End If
Next
Application.ScreenUpdating = True
End Sub


2114 679145413282 D 11 EW * 0
2114 679145413299 D 11.5 EW * 0
2114 679145413305 D 12 EW * 0
2114 679145413312 D 13 EW * 0
2462 679145413329 D 7 D * 0
2462 679145413336 D 7.5 D * 0
2462 679145413343 D 8 D * 0
2462 679145413350 D 8.5 D * 0
2462 679145413367 D 9 D * 0
2462 679145413374 D 9.5 D * 1

Columns in order ItemNumber, UPC Number, Type, Size, Width, Price, Quantity. I need to write a query that will return all "F" Types and only those "D" that have available quantities. Using the above example ItemNumber 2114 would not be returned whereas 2462 would be because it has 1 remaing 9.5
 

Users who are viewing this thread

Top Bottom