global variables

  1. S

    Global variables and constants

    Dim Rng As Range Dim rngCell As Range Dim LastRow As Long Dim LastColumn As Long Dim thisMonth As Long Dim thisYear As Long Dim wBk1 As Workbook Dim wBk2 As Workbook Dim xRg As Range Dim ws1 As Worksheet Dim ws2 As Worksheet Dim ws3 As Worksheet Dim ws4 As Worksheet Dim ws5 As Worksheet...
  2. M

    VBA: Global eNum / Variables or Constants?

    Dear all The workbook I am working with is set to be used with userforms only; there are around 20 of them. I have a number of variables of type byte which are repeatedly used in userforms. Is it a good idea to create global variables, global constants or enum whose values are set when the...
  3. V

    Creating Global Variables

    Hello, how can I create variable which can be accessed by all the codes in different workbooks. For example if I declare public function calculating date & now I want to access this variable in different workbook code. When I try to access such variable in different workbook module, VBA has...
  4. B

    Returning Global variables values via UDF

    I have a sheet with numerous Global variables declared in VBA with part of the name determined by a tenor, e.g. Pillar3m, Pillar6m, etc. I would like to use a UDF to be able to return these values based on the tenor. So if I ask for "3m" I get the Pillar3m value etc. I cannot seem to work out...
  5. A

    Assigning values to constant from userform in VBA

    I would like my code to take a value from textbox in the userform and use it as a constant for declaring values to other function for eg Const i1max=userform1.textbox1.value dim sys(1 to i1max) as computertype I am getting a compilation error stating that constnt variable should be defined...
  6. T

    Hidden Namespace

    Hello all! I just read a back and forth from July 2012 about using a Hidden Namespace to store a global variable, so that the values won't get reset when there is an error. I would like to ensure that the Hidden namespace value gets "erased" upon close of the program, even if the file has been...
  7. C

    saving and backing up global variables

    I have a spreadsheet with a list of global variables. I would like a code that runs through my project and returns the names of all global variables and values of these global variables, and places them in a spreadheet. i.e public variable1 as string public variable2 as string public...
  8. S

    Using Global Variables

    Hi, I'm setting up a sort of wizard where you make selections and move onto the next userform. There are 4 userforms in total and I want to set global variables to record the selections along the way. I've set public variables outside of any sub or function Public strFunction As String...
  9. B

    UserForm with Combobox

    Hi, this is my first post, I'm new using VBA. I'm using a userform with combobox. Combobox options are numbers from 1 to 12, what I need is define the option selected as a public or global variable, because I need to use that number in other macro. Thanks alot !!! <!-- / message -->
  10. B

    Global define workbook

    I am trying to globally define the workbook that houses the code as a variable and keep getting an Invalid Outside Procedure Compile Error. Here is my code: Public SOVComp As Workbook Set SOVComp = ActiveWorkbook Any thoughts?
  11. B

    VBA global variable contents clear?

    I've inherited a large Excel application that cashes data retreived from an Access database in VBA global variable arrays when the application starts up. It then builds worksheets from scratch by adding a default sheet to the workbook and inserting all formating and data. All calculations are...

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top