Hello
I'm using constants to set column number.
I've got a form to help me debug. I want to be able to select (in a combo box) the name of a constant, so that it returns its value. I've tried the function in a sub test, but it is not working...
I usually do stupid syntax/logic mistakes, but this time I can't find what is wrong..
'CONSTANTS Public CAVA As Long Public CAWF As Long Public CBND As Long Public My_Col Public My_Test Public Function GetCol() ' SET CONSTANT VALUE (Column number) On Error Resume Next CAVA = Sheets("DATA").Range("CAVA").Column CAWF = Sheets("DATA").Range("CAWF").Column CBND = Sheets("DATA").Range("CBND").Column ' a lot more End Function Public Function GetConst(sConst As String) As Variant 'GET CONSTANT VALUE WITH STRING NAME GetCol Select Case sConst Case "CAVA": MyCol = CAVA Case "CAWF": MyCol = CAWF Case "CBND": MyCol = CBND 'a lot more End Select End Function Sub test() GetCol 'My_Test = CWLO 'Sheets("DATA").Cells(2, 1) = My_Test 'OK GetConst (CTID) Sheets("DATA").Cells(3, 1) = MyCol 'NOTHING End Sub