Expected: = error when adding a comment '

LlebKcir

Board Regular
Joined
Oct 8, 2018
Messages
219
Ok, this is about as stupid as it gets. I added a comment inline with a filter.add code and get the above error, see image. For a comment to generate an error means Excel is refusing to acknowledge the ' comment flag. That is a problem.

was attempting to modify code from: Filtering 2D Arrays in Excel VBA

Setup the filter

Dim filter As New ArrayFilter
With filter
.name = "sam"
.category = "Medium"
.maxValue = 10
End With

Or

filter.add(1, "sam") 'column 1
filter.add(3, "Medium") 'column 3
filter.addMax(2, 10) 'column 2

Create the filtered data set

filteredArray = getFilteredArray(originalArray, filter)

The getFilteredArray is fairly straightforward to write: you loop over the array checking if the values match the filter and put the valid lines in a new array:

If filter.isValidLine(originalArray, lineNumber) Then 'append to new array

and attempting to modify the filter.add lines to match my desired editing to my array.

I have my 1st filtered array based on column headers between 2 tables in 2 different workbooks. That is functioning great. Now I need to filter down 2 more times. I have no issues if this has to be performed by creating 2 more arrays. None of the data sets are overly large (should be less than 400x41 in dimension RowxColumn) to start with.

The first filter (City/Network) should bring that down to around 150x41. The last filter will reduce only if there are blank values in the column Group. In most cities that last filter will not happen so a 4th array will not be built.

Array 1: masterSheetArr(), created manually for now, will need to make this variable dependent on user form input later
Array 2: colSortedArr(), created manually for now, will need to make this variable dependent on user form input later
Array 3: will be citySoftedArr(), not created yet. no clue how to filter out a column for a (string in this case) and copy all data in that row to new array.
Array 4: if needed will be allGroupArr() -> or something along that line. This array will just filter out any row that has a blank cell in the group column to create the 4th array

Note: If i comment out the entire line starting at 'filter.add Excel accepts that comment, but is ignoring the inline comment. WTF?
 

Attachments

  • Comment.error.PNG
    Comment.error.PNG
    37.6 KB · Views: 12

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It's not related to your comments, it's the fact that those brackets should not be there. You should be using:

Code:
filter.add 1, "sam" 'column 1
filter.add 3, "Medium" 'column 3
filter.addMax 2, 10 'column 2
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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