Declare Constant in Project Scope RRS feed

  • Question

  • I have a VBA Project in an Excel spreadsheet, that has ThisWorkbook, Sheet1 - Sheet5, Module1 and Module2.

    I need to declare a list of constants in scope of whole project so that I can use those constants anywhere in the project.

    Where they need to be put?

    Friday, August 30, 2013 12:25 AM

All replies

  • Re:  "declare a list of constants"

    Put them in Module1 or Module2 - scope in other types of modules is limited to the module.
    Put them at the top of the module, above your subs/functions and declare them as Public.

    Could resemble... Public Const Sludge As String = "Muddy"

    Jim Cone
    Portland, Oregon USA (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Edited by James Cone Tuesday, October 25, 2016 1:25 AM
    Friday, August 30, 2013 12:52 AM