For a work project, I need to output a certain value from a table - based on the criteria of one particular field in an autofilter. That value then needs to fill a particular cell. Also when the autofilter is only filtering blanks out then an "All" value needs to be outputted.
Because I know that there will not be any more criteria than there already are in that field, I can make a static VBA macro to do the job (which can be called upon as I need to). For proprietary reasons, I have constructed a similar sheet with:
Worksheet name - Outputs - Autofilter Worksheet name - Outputs - Output of Vlookup, Button 1 for Calling Subroutine Worksheet name - Inputs - Table of Value rnGPwjF.png usLOyUm.png VPhk0Me.png
I have the following formula working, tried it to make sure my input arguments were correct:
Rationale being that if I compare the number of visible cells in range to the number of visible cells with a certain criteria, I could determine the value of the autofilter and use vlookup as required. If I just look for the number of visible cells with a certain criteria being >0 then the case when "All" needs to be looked up, it wouldn't work.Please Login or Register to view this content.
This works for "A", "B", "C" ... "I". But I cannot get it to translate to the macro domain.
Macro so far:
Error: (At the start of first IF)Please Login or Register to view this content.
Q3iuSo5.png
I know that I should probably make a loop to reduce the code but that's step #2.
Thoughts??
Bookmarks