Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA string

Posted on 2014-01-23
3
Medium Priority
?
329 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 1240 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

Technology Partners: 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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 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