Thanks Leith, it worked. Thanks a lot buddy.
Leith Ross Wrote:
Hello Shivboy,
Try using a Select Case statement in place of the nested If ElseIf
statements...
Code:
--------------------
Function convertDiv(oDiv As String) As String
Dim wDiv, oDivID As String
wDiv = oDiv
Select Case wDiv
Case Is = "A"
oDivID = "1"
Case Is = "B"
oDivID = "2"
Case Is = "C"
oDivID = "3"
Case Is = "D"
oDivID = "4"
Case Is = "E"
oDivID = "5"
Case Is = "F"
oDivID = "6"
Case Is = "G"
oDivID = "7"
End Select
convertDiv = oDivID
End Function
--------------------
This makes your code easier to read and troubleshoot. Nested If
statements can become a real headache quickly. Not sure if you
renamed your ComboBox to Combo1, but if you didn't you need to change
it in your code to ComboBox1.
Sincerely,
Leith Ross
--
shivboy
------------------------------------------------------------------------
shivboy's Profile:
http://www.excelforum.com/member.php...o&userid=35137
View this thread:
http://www.excelforum.com/showthread...hreadid=559197