View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
El Bee El Bee is offline
external usenet poster
 
Posts: 58
Default Passing variables in macros

I thought I had this figured out; but apparently not.

I have variables I'm passing between subs and they are not being returned.

here's the code:
===========================================

Public Next_Prog, Last_Prog, Start_add As Variant
Public ProgName, Levels As String
-----------------------------------------------------------------------
Range("A2").Select
Prog_row = ActiveCell.Row
Selection.End(xlDown).Select
Last_Prog = ActiveCell.Row
Range("A2").Select
ProgName = ActiveCell.Value
Levels = ActiveCell.Offset(0, 1)
ActiveCell.Offset(1, 0).Select
Next_Prog = ActiveCell.Address

Range("D4").Select
Row_nbr = ActiveCell.Row
Start_add = ActiveCell.Address
Selection.End(xlDown).Select
Last_row = ActiveCell.Row
Range(Start_add).Select
Do While ActiveCell.Row <= Last_row
If ActiveCell.Value = ProgName Then
.... do statements

End If
Call Set_Prg_Name
Loop
---------------------------------------------
Sub Set_Prg_Name()
Range(Next_Prog).Select
If ActiveCell.Row Last_Prog Then

Else
ProgName = ActiveCell.Value
Levels = ActiveCell.Offset(0, 1)
ActiveCell.Offset(1, 0).Select
Next_Prog = ActiveCell.Address
Range(Start_add).Select
End If <the var value changes
here but is not
<transfered back
when returning to the
<previous calling sub.
End Sub