Replace your code with this...
Have only done Errors & Warnings buttons
Option Explicit
Private Crit As String
Private Sub UserForm_Initialize()
Dim Data
With Sheets("Warnings").ListObjects(1).Range
Data = Application.Index(.Value, Application.Evaluate("row(1:" & .Rows.Count & ")"), Array(2, 3, 4, 5))
With Me.ListBox1
.ColumnWidths = "30;50;325;450"
.ColumnCount = -1
.List = Data
End With
End With
End Sub
Private Sub OptionErrors_Click()
Crit = "E"
LbxPop
End Sub
Private Sub OptionWarnings_Click()
Crit = "W"
LbxPop
End Sub
Private Sub LbxPop()
Dim Data, Arr
With Sheets("Warnings").ListObjects(1).Range
Data = Filter(Evaluate("transpose(if(" & .Columns(6).Address & "=""" & Crit & """,row(1:" & .Rows.Count & ")))"), False, 0)
If UBound(Data) > -1 Then
Arr = Application.Index(.Value, Application.Transpose(Data), Array(2, 3, 4, 5))
With Me.ListBox1
.ColumnWidths = "30;50;325;450"
.ColumnCount = 4
.List = Arr
End With
End If
End With
End Sub
Bookmarks