Solved

VBA string

Posted on 2014-01-23
3
324 Views
Last Modified: 2014-01-23
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
0
Comment
Question by:leezac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39803298
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.
0
 
LVL 81

Accepted Solution

by:
byundt earned 310 total points
ID: 39803300
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

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39803316
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question