VBA - To return "open order" data.

pete4monc

Board Regular
Joined
Jan 12, 2014
Messages
88
Office Version
  1. 365
Platform
  1. Windows
Hi all

I was wondering if someone could help me with this conundrum.
I currently have a workbook with multiple pages and have this VBA working which looks for any dates that are more then 3 days out of the target completion time.
It populates the worksheet "Slowmovers", A column with the sheet name and B column with the order number. All works fine.
BUT
It Only finds the first field (sheet name and order number) regardless whether the order is open or closed. The issue is sometimes the order will have to go around the system again because of various reasons and appear twice on the worksheet.
How can I get it to report only the open order ie date is not entered in I column?

Hope this makes sense?
Thanks for any help.

VBA Code:
Sub Slowmovers()
   Dim ws As Worksheet
   Dim Ary As Variant, Rws As Variant
   
   Sheets("Slowmovers").Select
    Range("A2:B100").Select
    Selection.ClearContents
    Range("A2").Select
   
   For Each ws In Worksheets
      Select Case ws.Name
         Case "Phoenix", "Overview", "Dashboard", "Input", "Tracker", "Holiday List", "Log"      'sheets that should be ignored
         Case Else
            With ws.Range("B5:B" & ws.Range("L" & Rows.count).End(xlUp).Row)
               Rws = Filter(ws.Evaluate(Replace("transpose(if((@>3)*(@<>""""),row(@)-min(row(@))+1,false))", "@", .Offset(, 10).Address)), False, False)
               If UBound(Rws) >= 0 Then Ary = Application.Index(.Value, Application.Transpose(Rws), 1)
            End With
            If UBound(Rws) >= 0 Then
               With Sheets("Slowmovers").Range("A" & Rows.count).End(xlUp).Offset(1)
                  .Resize(UBound(Ary)).Value = ws.Name
                  .Offset(, 1).Resize(UBound(Ary)).Value = Ary
               End With
            End If
      End Select
   Next ws
   
   Range("D1").Value = Format(Now, "mm/dd/yyyy HH:mm:ss")
End Sub

1684160683863.png


1684160821429.png
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top