View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
El Bee El Bee is offline
external usenet poster
 
Posts: 58
Default Returning vars to calling sub

I'm not sure what I'm doing wrong here. the first sub calls the second sub
which sets 2 vars (prog_name & Levels). These values are not being returned
to the calling sub.

thanks for looking.

see below.


Public Next_Prog, Last_Prog, Start_add As Variant
Public ProgName, Levels As String



Sub Step2_Extract_Profiles()
Dim logOn, Prof_row, Row_nbr, Last_row As Variant
Dim copy_From, ProgName, Levels As String

Dim rCell As Range
Dim cell As Range

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
End If
GoSub Set_Prg_Name
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub



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 'values change here but are not
returned to calling sub
end if
End Sub