frisbeenut
Member
I am hopeful that someone here can assist me in writing a VBA search function that accepts 2 parameters, a string and a column range. I have a column of string values that are 6 characters long that begin with 5 numbers and ends with a capital letter, starting with the letter 'A". I want to pass a 5 digit number string and a column range to this function. The function will add a single capital letter to end of this 5 digit number beginning with 'A' and search the column for a match. If a match is not found, then return this 6 digit string and exit the function. If it a match is found, then iterate the last character upward through the alphabet 'B', then 'C', ... 'Z' until a match is not found and return the 6 digit string and exit the function. If by chance a match is found with the letter 'Z', then exit the function with an alert box. Note: the column of numbers may contain blank cells.
I am undecided about the length of the column of strings and I might have a column of 5 character strings instead and pass a 4 digit number string instead. Perhaps this function can have a third parameter that specifies the length, or make it so the function does not care about the length as long as the column of strings is one character longer than the number string being given to the function.
Thanks so much for everyone's help.
I am undecided about the length of the column of strings and I might have a column of 5 character strings instead and pass a 4 digit number string instead. Perhaps this function can have a third parameter that specifies the length, or make it so the function does not care about the length as long as the column of strings is one character longer than the number string being given to the function.
Thanks so much for everyone's help.
Last edited: