From: fi.or.jp.de on
Hi All,

I have macro like this

sub unique()

''''''''
''''''''
Counter_item = 0
For Each Item In nodups
counter_item = counter_item + 1
bic_var = Item
Call Ps_Match
Next Item

end sub

I have another macro

Sub Ps_Match()
'''''
'''''
If counter_item <= 1 Then
call another_macro()
end if
end sub

In the first macro i am declaring counter_item equals to 1.

In my second macro i need to call that number.


From: JLGWhiz on
At the to of the module put:

Public Counter_Item As Long

It has to be outside the macro and then either macro can use and set the
value of it.

"fi.or.jp.de" <fi.or.jp.de(a)gmail.com> wrote in message
news:838dedc3-43b9-455b-acbd-ea48648c2f37(a)31g2000prc.googlegroups.com...
> Hi All,
>
> I have macro like this
>
> sub unique()
>
> ''''''''
> ''''''''
> Counter_item = 0
> For Each Item In nodups
> counter_item = counter_item + 1
> bic_var = Item
> Call Ps_Match
> Next Item
>
> end sub
>
> I have another macro
>
> Sub Ps_Match()
> '''''
> '''''
> If counter_item <= 1 Then
> call another_macro()
> end if
> end sub
>
> In the first macro i am declaring counter_item equals to 1.
>
> In my second macro i need to call that number.
>
>


From: Rik_UK on
Hi

Global variables work, but it is also good practice to pass variables beween
proceedures.

sub unique()
Dim counter_item as integer 'declare variable
''''''''
''''''''
counter_item = 0
For Each Item In nodups
counter_item = counter_item + 1
bic_var = Item
Call Ps_Match (counter_item) 'pass integer data to called process
Next Item

end sub

I have another macro

Sub Ps_Match(cntr_item as integer) 'added variable declaration here
'''''
'''''
If cntr_item <= 1 Then
call another_macro()
end if
end sub