View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Syntax Error '1004'

Hi Minitman

"It was working until I changed the calling method to include a variable to
simplify the code." This surprises me. However, if you called it with the
following method it would have worked.

Call InvCol_1(vName, vNum)

However, having said that, the only code you should have in the Userform
code area is the event code for the userform. All other code which is called
should be in a standard module and if you move the called code to a standard
module you will most likely fix the problem.

--
Regards,

OssieMac


"Minitman" wrote:

Greetings,

I am attempting to run this macro :

For this example x equals 1, 2 or 3. vName & vNum together is the
name of the originating TextBox.

Here is the code fragment in question:

Run "InvCol_" & x, vName, vNum

This will run one of the three procedures known as InvCol_1, InvCol_2
or InvCol_3 each with the pass though arguments of vName & vNum.

The problem is the VB error message:

Run-time error '1004'
The macro 'InvCol_1' cannot be found.

VB is calling it a macro, I'm not sure if that means anything or not.
The full name of the procedure is:

Public Sub InvCol_1(vName As Variant, vNum As Variant)

It is in the UserForm code area as is the rest of this code, It was
working until I changed the calling method to include a variable to
simplify the code.

Can anyone see what I did wrong to mess up this code and, more
importantly, how do I fix it?

Any help will be appreciated.

-minitman
.