Function Writing suggestions
Posted by Kevin James on May 21, 2001 8:38 PM
Hi all. I am continuing my study of VBA at lightning speed (whoa, did you see that snail just race by me?). Okay, so I'm in granny gear.
I just wrote the following function and it works perfectly. (You seasoned veterans will laugh at its simplicity, but it works.):
Function DupFind(apples, oranges) As Boolean
' Created By: Kevin James
If apples = oranges Then DupFind = True Else DupFind = False
End Function
I used this in a single-column, sorted list containing duplicates, giving it the first and second cells (A1,A2) as input and then copying it down.
Now, before I ask my question, please understand that I do NOT WANT you to GIVE me the answer. What I want is for you to give me hints, direct me to VBA constructs and commands.
Here's my question. I was able to take my function and write in cell b2:
=if(DupFind(A2,A1),"duplicate","") so that instead of seeing TRUE or FALSE, I would see an empty cell for false and "duplicate" for true condition. I want to create that as a function but I can't figure out how to give two inputs to a boolean function and return "duplicate" or null.
Just hints, PLEASE.
Loving the Learning Experience,
Kevin