Range("D2:D11").Find(What:="No Commission", LookIn:=xlComments).Select In LookIn part we are searching this word in comments so select xlComments and then pass the argument as. Step 3: Ignore the After part and select the LookIn part. Step 2: In the WHAT argument type the word “No Commission”.
Step 1: Start code with mentioning the Range (“D2:D11”) and put a dot (.) and type Find From this comment, I want to search the word “No Commission”. Those cells having red flag has comments in it. I have data and in three cells I have a comment.
Now I will show you how to find the comment word using the find method. Step 8: Then run this code using F5 key or manually as shown in the figure, so it would select the first found word Johnson which contains a word, John. We need to select the word, so pass the argument as. Step 7: The final part is after finding the word what we want to do. In order to highlight the argument we can pass the argument like this What:=, this would be helpful to identify which parameter we are referring to. Step 6: Our first argument is what we are searching for. Step 5: Select the FIND property and open the bracket. Step 4: After mentioning the range put a dot (.) and type FIND. In our example, our range is from B2 to B11. Step 3: So first mention the range where we are looking for. Step 2: Here you cannot start the word FIND, because FIND is part of RANGE property. So, firstly we need to mention where we are looking i.e. Step 1: From this, I want to find the name John, let’s open a Visual basic and start the coding. Assume below is the data you have in your excel sheet.
You can download this VBA Find Excel Template here – VBA Find Excel Template VBA Find Function – Example #1įirst up let me explain you a simple example of using FIND property and find the content we are looking for. We will learn how to use a VBA Find Excel function with few examples. In the examples section, we will see how to use this FIND method in VBA coding. Apart from the first parameter, everything is optional. This is the explanation of the syntax of the VBA FIND method. If you are searching for format then you need to use Application.FindFormat method. SearchFormat: Are you searching by formatting.
MatchByte: This is only for double-byte languages. MatchCase: The content you are searching for is case sensitive or not. SearchDirection: Are you looking at the next cell or previous cell. SearchOrder: Are you looking in rows or Columns.
LookAt: Whether you are searching for the whole content or only the part of the content. Parameters are xlFormulas, xlValues, xlComments. LookIn: Where to look for the thing you are searching For example Formulas, Values, or Comments. After: After which cell you want to search for.