global variable

  1. M

    Using With...End statement to set fields for two userforms

    Hello, I am a VBA neophyte learning on the job. I have two userforms that I am programming for a spreadsheet. Each user form uses many of the same fields, and so in the code for each userform I have to set the fields up in the same way, i.e. below txtTodayDate.Text = Format(Now()...
  2. Z

    VBA Using variable workbook and worksheet in a different sub

    Here is the code I have right now Public ReportFile as Workbook Public ReportWorksheet as Worksheet Sub VBA_Project() Define_File Define_Tab Data_Cleanup End Sub Sub Define_File() Dim ReportFilePath As Variant ReportFilePath = Application.GetOpenFilename(filefilter:="excel...
  3. M

    "True" is true throughout worksheet

    In one application, I want to determine if a value is true or false. But, once it is set to "True", I want to use this fact throughout the worksheet. Conversely, if this value is "False", I want to likewise use this fact throughout the worksheet. This is the code I'm using to determine what...
  4. B

    Compile error, Automation error - Global variable problem?

    I have some VBA code which has been running quite happily for the last two or three years. Starting a couple of days ago it now fails every time with runtime error "Compile error. Automation error". There are no error numbers or codes given. On clicking OK on the error box the processing...
  5. Z

    How to save a userfor textbox input as a global variable to use late?

    So I am using the Private Sub CommandButton1_Click() to get some values from the user and most of them go to certain cells on my worksheet. However, there is one particular value (a dollar amount) that I do not want to store, but use later on to compare against a different value. I tried...
  6. S

    World sheet to feed through to region sheet

    Happy Friday! I've got a large spreadsheet (4k rows) of contacts who have standard columns with addresses, emails etc. AND all have the country where the contact is located. Every single entry has this value. I want to make three spreadsheets for global regions (Europe, North America, ROW)...
  7. K

    Calling Public/ Global Variables Between Modules (Inside Worksheet Change Code)

    Hello, All I need, is to be able to call the public variable 'lastrow2' from the module it is defined in to the sheet 1 object. I have the following code: IN THE 'Sheet1(Drawings List)' OBJECT [I have omitted some irrelevant code]: Private Sub Worksheet_Change(ByVal Target As Range) Dim...
  8. D

    How to match worksheet names against global variable?

    Objective: I would like to ask the user if when the name the worksheet the same as an already existing spreadsheet tabe if they would like to overwrite it or unload the user form. I am not sure of two things: 1. how to find the already existing tab? 2. Once I find out how do I programatically...
  9. C

    How to use Global variable in Windows( ).Activate

    <tbody style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;"> I have set some Global variables and they are working, without the GV I have<code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; background-color...
  10. E

    Trouble with Public Dynamic Array

    Hi, I've been looking online for the last couple of hours for a solution to my problem. I've created a sub that works if I declare the array within the sub (see commented out declaration line below). However, I want to use the array in another module. So I've added in the Public line at the top...
  11. S

    Global Variable Empty Value when used in Array

    Hi all, I have a global variable, FinalRow, which calculates the finalrow of the records in the Worksheet_Activate event. The global variable is declared in a module. I created a button and assigned a macro (below) to it to allow users to view the records. I used an array in it. Sub...
  12. S

    Global variable

    Hi all, is it possible to declare a variable in ThisWorkbook and use the variable in module procedures? Basically i want to create a global variable somewhere that allows me to use the variable in events, modules and procedures. i'm using excel 2003
  13. E

    Copy Global Variable into a Cell in VBA Function

    Hi everyone, How can I assign a value held by a global variable into a cell from within a VBA function? Function needs to make some if-then analysis therefore reaching a global variable from within a cell -even if it is possible, is not what I am after. The Function in VBA should be copying...
  14. paipimenta

    Global variable for add-in?

    I'm working on an add-in that will have a user-form to make changes to a complex workbook. The add-in changes workbook "Audit Form.xls". How can I set this file name as a global constant in my add-in, so that I can just change this file name once in the add-in? I'm looking for something like...

Some videos you may like

This Week's Hot Topics

Top