Solved

VBA string

Posted on 2014-01-23
3
320 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

My experience with Windows 10 over a one year period and suggestions for smooth operation
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

733 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