VBA string

I did not write this code and it looks like is is looking at a string.  Where would the string be? There is no indication where at this point and it is at the top of the code.  Thanks in advance.

Sub Generate(ab As String)
Dim r As Range, impbol As Boolean 'Impact boolean
Dim dest As Range, dest_emm As Range

If ab = "Vendor" Then ' if string = vendor
  ClearTab Sheet27.Name, 2
  ClearTab Sheet23.Name, 1
  Set r = Sheet21.Range("B3")
  Set dest = Sheet27.Range("A3")
  Set dest_emm = Sheet23.Range("A3")
End If

If ab = "Broker" Then
  ClearTab Sheet26.Name, 2
  ClearTab Sheet22.Name, 1
  Set r = Sheet20.Range("B3")
  Set dest = Sheet26.Range("A3")
  Set dest_emm = Sheet22.Range("A3")
End If

End Function
Who is Participating?
byundtConnect With a Mentor Commented:
If you mean the string variable ab, that is being passed to the sub when it is called. To see where the value is actually coming from, you need to look at the statement that calls the sub Generate. It should be a statement like either of:
Generate "some text"
Generate SomeStringVariable

Open in new window

It's not looking for a string. It tests the value of the string that is passed into the procedure as an argument, and taking different actions, depending on which of two values it is.
I've just noticed that the procedure is a Sub at the start and a Function at the end. This would give a compile-time error and wouldn't run.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.