A
AntSalc
Guest
I have to run a long Select Case statement, like the one below, in a loop.
It is slow
Is there a faster alternative?
I have only found in this forum some posts comparing Select Case to If then, which is not an alternative in my case.
Also, it would be good if the alternative were easy to update with new values.
Select Case BB_base_f
Case "MAB", "INDV", "RYA", "WTB", "LLOY", "TSCO", "NEX"
exch = "LN"
Case "RY4C"
BB_base_f = "RYA"
exch = "LN"
Case "RB."
BB_base_f = "RB/"
exch = "LN"
Case "BP."
BB_base_f = "BP/"
exch = "LN"
Case "UCG", "UCGAZ"
exch = "IM"
Case "INGP", "ING", "INN"
BB_base_f = "INGA"
exch = "NA"
Case "EBO", "EBS"
BB_base_f = "EBS"
exch = "AV"
Case "ITK", "ABI"
exch = "BB"
Case "ABIT"
BB_base_f = "ABI"
exch = "BB"
Case "1NBA"
BB_base_f = "ABI"
exch = "BB"
Case "AGN", "ASML", "INGA", "SBMO"
exch = "NA"
Case "IHCB"
BB_base_f = "SBMO"
exch = "NA"
Case "ARRB", "MT"
BB_base_f = "MT"
exch = "NA"
Case "CIL"
BB_base_f = "LG"
exch = "FP"
Case "AXA"
BB_base_f = "CS"
exch = "FP"
Case "TOTB"
BB_base_f = "FP"
exch = "FP"
Case "VVD", "VIE"
BB_base_f = "VIE"
exch = "FP"
Case "THP"
BB_base_f = "TEC"
exch = "FP"
Case "AIR", "BN", "BNP", "CEI", "CEIDS", "CS", "FP", "OR", "SU", "TEC", "MC"
exch = "FP"
Case "EAD"
BB_base_f = "AIR"
exch = "FP"
Case "BSD2"
BB_base_f = "SAN"
exch = "SM"
Case "SAN1"
BB_base_f = "SAN"
exch = "SM"
Case "ITX", "TEF", "SAN", "REP
exch = "SM"
Case "ATCO.A"
BB_base_f = "ATCOA"
exch = "SS"
Case "ELUX.B"
BB_base_f = "ELUXB"
exch = "SS"
Case "SAND", "EPROB"
exch = "SS"
Case "GEBN", "NESN", "ROG", "RUKN", "SREN", "SYNN", "UBSN", "UBSN2", "SIKA"
exch = "SW"
Case "1398", "2628"
exch = "HK"
Case "8316.T", "8316"
BB_base_f = "8316"
exch = "JP"
Case "7203", "7751"
exch = "JP"
Case "1963.T", "1963"
BB_base_f = "1963"
exch = "JT"
Case Else
BB_base_f = " Check "
End If
End Select
Continue reading...
It is slow
Is there a faster alternative?
I have only found in this forum some posts comparing Select Case to If then, which is not an alternative in my case.
Also, it would be good if the alternative were easy to update with new values.
Select Case BB_base_f
Case "MAB", "INDV", "RYA", "WTB", "LLOY", "TSCO", "NEX"
exch = "LN"
Case "RY4C"
BB_base_f = "RYA"
exch = "LN"
Case "RB."
BB_base_f = "RB/"
exch = "LN"
Case "BP."
BB_base_f = "BP/"
exch = "LN"
Case "UCG", "UCGAZ"
exch = "IM"
Case "INGP", "ING", "INN"
BB_base_f = "INGA"
exch = "NA"
Case "EBO", "EBS"
BB_base_f = "EBS"
exch = "AV"
Case "ITK", "ABI"
exch = "BB"
Case "ABIT"
BB_base_f = "ABI"
exch = "BB"
Case "1NBA"
BB_base_f = "ABI"
exch = "BB"
Case "AGN", "ASML", "INGA", "SBMO"
exch = "NA"
Case "IHCB"
BB_base_f = "SBMO"
exch = "NA"
Case "ARRB", "MT"
BB_base_f = "MT"
exch = "NA"
Case "CIL"
BB_base_f = "LG"
exch = "FP"
Case "AXA"
BB_base_f = "CS"
exch = "FP"
Case "TOTB"
BB_base_f = "FP"
exch = "FP"
Case "VVD", "VIE"
BB_base_f = "VIE"
exch = "FP"
Case "THP"
BB_base_f = "TEC"
exch = "FP"
Case "AIR", "BN", "BNP", "CEI", "CEIDS", "CS", "FP", "OR", "SU", "TEC", "MC"
exch = "FP"
Case "EAD"
BB_base_f = "AIR"
exch = "FP"
Case "BSD2"
BB_base_f = "SAN"
exch = "SM"
Case "SAN1"
BB_base_f = "SAN"
exch = "SM"
Case "ITX", "TEF", "SAN", "REP
exch = "SM"
Case "ATCO.A"
BB_base_f = "ATCOA"
exch = "SS"
Case "ELUX.B"
BB_base_f = "ELUXB"
exch = "SS"
Case "SAND", "EPROB"
exch = "SS"
Case "GEBN", "NESN", "ROG", "RUKN", "SREN", "SYNN", "UBSN", "UBSN2", "SIKA"
exch = "SW"
Case "1398", "2628"
exch = "HK"
Case "8316.T", "8316"
BB_base_f = "8316"
exch = "JP"
Case "7203", "7751"
exch = "JP"
Case "1963.T", "1963"
BB_base_f = "1963"
exch = "JT"
Case Else
BB_base_f = " Check "
End If
End Select
Continue reading...