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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

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