Showing posts from September, 2019

Finding a String within a List of Strings

Don't you think it's too easy to perform such a procedure using INSTR function? Yup, it's damn easy but the reason behind writing this post was a little bit core side of the problem. Let's take an example here suppose you have 100 cells containing a string. Now, you want to extract the cell address where the cell's string contains "1p" or anything else. Now, Cell's string could have been anything but you have to find a specific string within a set of cells. It's very easy to find such using following code. dim I as Long  For I = 1 to 100 Step 1 if VBA.Instr(1,Cells(I,1).value, "1p") > 0 then  msgbox .cells(i,1).Address end if  Next I  Above code will simply give you the address of the matching cell with string. But here comes the catch. String 1p is in standard or lower case and you might don't know in the cells which case would be there so, to avoid that confusion programmer generally uses the following line using O