Reset or clear variable within a module 
Author Message
 Reset or clear variable within a module

I have a worksheet from which I want to take each record and move the data
to other worksheets depending upon the value in the first column. I would
like to be able to set thevariable, run a sub procedure, then move the
ActiveCell point down one, reset the variable to the name in that cell and
run the sub procedure again. Totally baffled by this. Any help would be
appreciated.

TIA

Rick Campbell



Sat, 03 Sep 2005 20:40:39 GMT  
 Reset or clear variable within a module
If you're using a global variable, perhaps something like
this:

Dim Cell as Range
For each Cell in Range("A1:A100")
  MyVariable = Cell.Value
  Call MySub
Next

If you modify the sub to take an argument, i.e.
Public Sub MySub(ByVal CellVal as String)
you could call it like this:

MySub CellVal:= Cell.Value

Charlie

Quote:
>-----Original Message-----
>I have a worksheet from which I want to take each record
and move the data
>to other worksheets depending upon the value in the first
column. I would
>like to be able to set thevariable, run a sub procedure,
then move the
>ActiveCell point down one, reset the variable to the name
in that cell and
>run the sub procedure again. Totally baffled by this. Any
help would be
>appreciated.

>TIA

>Rick Campbell

>.



Sat, 03 Sep 2005 21:10:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using a form seems to reset module-level public variables

2. Access resets variables when modifying a forms module from code

3. How to reset module-level variables in VBA

4. Call Function with Variable within Forms module

5. Variables- How do I keep a Variable from being reset when closing excel

6. Calling module within module

7. Searching code within Modules (within multiple workbooks)

8. Class modules 97 - Refering to array within a custom class module

9. Referring to a variable in module 1 from module 2

10. Transferring variable values from Private module to standard module


 
Powered by phpBB® Forum Software © phpBB Group