I need some checking done

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all i wrote a vb function and it doesnt seem to be working, help me out
and check it over

Here is the code:

Dim Amps As Range
Dim BrkL As Range
Dim CondMat As Variant
Dim CondTemp As Variant
Dim Conduit As Variant
Dim CondInsul As Variant
Dim CondTbl As Worksheet
Dim FeedEst As Worksheet
Dim Conductor As String

Public Function CdLkUp(BrkL, Amps, CondMat, CondTemp) As Variant

Set CondTbl = Worksheets("Conductor Tables")
Set FeedEst = Worksheets("Feeder Est.")

Select Case Amps
Case Is <= 20
CondLookup = CondTbl.Range("S43")

Select Case CondMat
Case Is = "Cu"
Select Case CondTemp
Case Is = 60
CdLkUp = Application.WorksheetFunction.VLookup(BrkL, _
CondTbl.Range("b10:e39"), 4, True)
Case Is = 75
CdLkUp = Application.WorksheetFunction.VLookup(BrkL, _
CondTbl.Range("c10:e39"), 3, True)
Case Is = 90
CdLkUp = Application.WorksheetFunction.VLookup(BrkL, _
CondTbl.Range("d10:e39"), 2, True)
End Select
Case Is = "Al"
Select Case CondTemp
Case Is = 60
CdLkUp = Application.WorksheetFunction.VLookup(BrkL, _
CondTbl.Range("f10:i39"), 4, True)
Case Is = 75
CdLkUp = Application.WorksheetFunction.VLookup(BrkL, _
CondTbl.Range("g10:i39"), 3, True)
Case Is = 90
CdLkUp = Application.WorksheetFunction.VLookup(BrkL, _
CondTbl.Range("h10:i39"), 2, True)
End Select
End Select
End Select
End Function
 
You may find someone who's willing to "check it over", but before
spending any time on it, it would be very helpful if you'd at least
indicate what the function should do, and what "doesn't seem to be
working" means (do you get a crash? the wrong result? no result? a
result error? a run-time error?)
 
Andy,
Appears to work OK EXCEPT if Amps>20 when no VLOOKUP is executed.

Should CondLookup be CdLkUp?

If not, what is CondLookup ?

And, as per previous posting, what exactly is the problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top