Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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?) In article , "Andy" wrote: Hello all i wrote a vb function and it doesnt seem to be working, help me out and check it over |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Andy,
Appears to work OK EXCEPT if Amps20 when no VLOOKUP is executed. Should CondLookup be CdLkUp? If not, what is CondLookup ? And, as per previous posting, what exactly is the problem? "Andy" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Spell Checking with checking cell notes | Excel Discussion (Misc queries) | |||
Day Checking | Excel Discussion (Misc queries) | |||
Checking | Excel Programming | |||
Checking for changes. | Excel Programming | |||
#NUM checking | Excel Programming |