Hello. I have current code that will write a date to a worksheet after the code has successfully run. The code just updates sheet data from a report, which isn't relevant to this question. However, the reason the code writes the update date to the sheet is so that it can be used in a...
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...
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...
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...
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...
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...
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...
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...
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...
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 -->
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?
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...
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.