Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have developed a macro that does a whole bunch of things for me based on a few things. (Importing files).

The file names are dated dd_mm_yyyy and right now I enter them into a sheet where the macro can retrieve the information. Not really wanting this I designed a userform where the user can enter the "dd", "mm", "yyyy" and how many consecutive days of files there are.

For example:



there would be one consecutive day.

I want to be able to retrieve the information entered in the userform (day, month, year, and consecutive days) to use in the macro and have been unsuccessful because I don't know how to access that information. Is it similar to referring to a range in a worksheet?

The userform I designed

share|improve this question
up vote 2 down vote accepted

Use Something like:


Every control has a name, which you can get (and set) by right-clicking on the textbox in design mode and choosing properties.

'Me' refers to the Form itself.

share|improve this answer
I realize I can use it to program the Userform itself but can I use the "Me" Object(?) inside the macro? When i tried to use the user-form to set variables for the macro it didn't work. – B-Ballerl Jun 29 '11 at 4:34
You can also pass parameters or use a class or a global. Global variables would be the easiest, but also the easiest to mess up, but I've used a few in VBA when I needed them. – Lance Roberts Jun 29 '11 at 4:42
It worked, I guess I just didn't understand the idea that the "textbox1" was an object and held a value. Like the comparison worksheet to a cell or range as a userform is to a field or control – B-Ballerl Jul 1 '11 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .