RobExcel
RobExcel

Reputation: 191

Compilation error in VBA

Goodmorning from Holland,

I'm just n00bing around VBA, and keep bumping in to said compilation error as seen in this screenshot; Screenshot I would like to see this solved, but i want to learn how to kill these horrible errors. What is my mistake?

Upvotes: 0

Views: 279

Answers (2)

Verzweifler
Verzweifler

Reputation: 940

As the error message is telling you, you are missing one End If-Statement: You are opening three If-Cases, but close only two of them. (I guess you want to put the missing one before the line saying If not Rng Is Nothing Then, thus closing the statement If Trim(FindString) <> "" Then)

For the future: Proper indentation of your code will help you spot errors like this easily!

Upvotes: 2

MaxD
MaxD

Reputation: 377

Your "If Not Rng Is Nothing Then" is missing an "End If"

It should be more obvious if you indent correctly your code.

Upvotes: 2

Related Questions