declaring variables

  1. J

    Declaring variables: VB.NET Vs. VBA?

    In VB.NET, a variable is declared using the syntax Dim Foo As Integer = 10 I have just discovered that in VBA this does not work, and must instead be written as either Dim Foo As Integer Foo = 10 or as Foo = 10 Is the second of these an acceptable way of declaring a variable? If not, what...
  2. D

    Declaring variables for use in formulae

    Hello! I had posted this question on Stack Overflow, but was told that it isn't the right place for such a question. I have two sheets in Excel, one with formulae calculating business costs, and another where I'm trying to calculate revenue projections based on those costs. Images: Costs...
  3. Kelinky_Sama

    Defining a Variable Whose Name Is Composed of Multiple Strings

    I'm not entirely sure if that name is the most understandable. Oh, well. This falls in the same general vein as the last question I asked (which has been answered, and I am quite thankful for that), but plays out in reverse. I'll use a similar example situation for consistency. Now, say that I...
  4. Kelinky_Sama

    Simplifying Variable Declarations with Other Variables

    I'm rather new to Excel macros, so please be patient if I'm asking for something that should be rather simple. What I'm attempting to do is recreate an RPG "inventory" of sorts with a UserForm in Excel VBA. So far, the way I've managed this has been by placing a ToggleButton underneath a...
  5. S

    Question about variables & public variables

    Hello All, So I wanted to change the way I create macros usually (I'm no expert but want to be one), and decided that I want to declare my variables once as public if I use them in multiple modules and subs. And I had an example like this: Option Explicit 'Variables only here Public wsP...
  6. K

    How can I create a variable that will hold worksheets objects/worksheet names?

    I want to preform certain code on designated worksheets in my workbook. I only want to do this code for some of the worksheets, but not all of them. What I would like to do is the following: For Each ws in ActiveWorkBook.Worksheets 'do some code Next ws Since I only want to run the code...

We've detected that you are using an adblocker.

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.
Go back
Back
Top