Assigning '=FILTER' Value to variable giving 2015 Error

vbaNumpty

Board Regular
Joined
Apr 20, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
I am getting a 2015 Error and I cannot figure this one out for the life of me.

I have the following table with a working FILTER formula:
filter 2.png
Filter1.png


But in VBA I get a 2015 Error:
filter3.png


Just showing that the = Value is calculating correctly
filter 4.png


Any help with this?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
VBA Code:
Private Sub PID_Change()
'This will make the colour selection populate with only appropriate results
    Dim ClrList As Worksheet
    Dim PckList As Worksheet
    Dim Fields As Worksheet
    Dim GrnPlant As Variant
    Dim pkSize As Variant
    Dim i As Integer

    Set ClrList = Worksheets("Color List")
    Set PckList = Worksheets("Packsize")
    Set Fields = Worksheets("Fields Lists")
    
    Me.AssBox.Clear
    Me.AssBox.Enabled = False
    
    
    pkSize = Evaluate("=FILTER(PackSize[Pack Size],PackSize[Product ID]= """ & Me.PID.Value & ""","")")
    'CaseQty.List = Evaluate("=FILTER(PackSize[Pack Size],PackSize[Product ID]=""" & PID.Value & ""","")")
    
    GrnPlant = Evaluate("=INDEX(GreenPlant[Green Plants],MATCH(""" & Me.PID.Value & """,GreenPlant[Green Plants],0))")
        
    If IsError(GrnPlant) Then
        AssBox.Enabled = True
    End If
    
    For i = 2 To Fields.Range("M" & Application.Rows.Count).End(xlUp).Row
        Me.AssBox.AddItem Fields.Range("M" & i).Value
    Next i

End Sub

There you are sir!
 
Upvote 0
You appear to be missing some quotes at the end:

Code:
"=FILTER(PackSize[Pack Size],PackSize[Product ID]= """ & Me.PID.Value & ""","""")"
 
Upvote 0
Solution
You appear to be missing some quotes at the end:

Code:
"=FILTER(PackSize[Pack Size],PackSize[Product ID]= """ & Me.PID.Value & ""","""")"
Of course it would be something as simple as quotes. Man I am dumb..

Would you happen to know how I could assign this filters values to a combobox now :unsure:?
 
Upvote 0
Something like
VBA Code:
Me.ComboBox1.list=pkSize
 
Upvote 0
Something like
VBA Code:
Me.ComboBox1.list=pkSize
I need to step away from the computer.. Thanks! I was about to tell you I tried that and realized I assigned the list to the wrong box
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,955
Latest member
BatCoder

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