Hi all,
I recently changed a sub routine from multiple if, elseif... to using a for loop. this sub recieved input from a user and wrote the data to a sheet column. The columns in which the data is written depends on the item "each item has "OWN" store(columns). I converted to for loop because i used consistent naming e.g AA_Qtty, BB_Qtty, CC_Qtty and i had the list of items somewhere i.e (AA, BB, CC). so i figured i could just concatenate the names of items to prefix i.e "CC"+"_Qtty" and pass this to the necessary searches
the row topRow and col as you may be able to see are used to locate the places to place the items properties.
However the line with match rejects the strin value and returns error 2029. This code worked previously with the actual name (hard coded). I tested the code by replacing the strin value for the match with an actual name and the error did not occur. Closer inspection made me realise that unlike the other methods match works when the name is coded without the double quotes
i.e
instead of
as i would have used in the other methods such as
It seems to me that the strin is passed with its double quotes i.e strin="value". However this seems to conflict the evaluate function by breaking it up into two strings and characters in the middle
i.e "=Match(True," value, "<>0,0)".
So it seems to me that the only solution is to hardcode, but i dont like writing alot of code when i can just use a less than 10 lines in place of over 80 lines of code.
All suggestions appreciated
Stephen
Bookmarks