using Dim function

agiammo

Board Regular
Joined
May 9, 2002
Messages
68
I have a general question. I have a nice bit of code (thank you Nate!) that uses two dims. I've been able to plug this into various macros with no problems.

Previously, I have used it in a macro that opens up four different workbooks and uses the exact same code in each.

Currently, I'm working on a macro where I wanted to use this code twice in the same workbook, but on different sheets. I was given a 'duplicate' error message. Ok, so I figured out all I need to do is change the letter.

But my XL book sucks. It doesn't explain how these dims really operate. Does anyone have a good resource to share? I'd like to read more about this function so I really understand what I'm doing with it.

THANKS!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
The VBA Help file "Declaring Variables" is fairly complete
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Dim declares variables and allocates storage space. It is short for Dimension, which, in old versions of basic, was used to declare the dimensions of an array. For more information search for Dim in VBE Help.

You can declare a variable only once within a procedure or at the top of a module, but you can use it more than once by assigning a different value to it.
 

Forum statistics

Threads
1,143,709
Messages
5,720,389
Members
422,282
Latest member
psunith

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
Top