View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
baptism by fire baptism by fire is offline
external usenet poster
 
Posts: 1
Default Using 'i' to calculate public variables

If anyone can help me out:

I've written some code that uses public variables and the values transfer
fine from one sub to the next when placed in sequence. But for some reason I
can't get a set of variables to transfer to another sub when I perform
calculations were I'm selecting the variable name with the 'i' variable.

I'm going to past in the variables declared and the sub that's not working
properly. Could a more knowledgeable person tell me what's breaking down?
Thank you.

Public Row_Constant As Integer
Public Spacer As Integer
Public Stores_Per_Graph_1 As String
Public Stores_Per_Graph_2 As String
Public Stores_Per_Graph_3 As String
Public Stores_Per_Graph_4 As String
Public Number_of_Graphs As String
Public Store_Count As Integer
Public i As Integer

Sub GET_STORES_PER_GRAPH()

Number_of_Graphs = 2
Store_Count = 29

Dim a As Integer
Dim Stores_Used As Integer

a = 0
i = 1

MsgBox ("This is " & Stores_Per_Graph_i)

Do

Stores_Per_Graph_i = Ceiling((Store_Count - Stores_Used) / (Number_of_Graphs
- a))
Stores_Used = Stores_Used + Stores_Per_Graph_i

MsgBox ("This is " & Stores_Per_Graph_i)

i = i + 1
a = a + 1
Loop Until (Number_of_Graphs - a) = 0

End Sub

Sub GET_STORES_PER_GRAPH_1 ()

MsgBox ("This is " & Stores_Per_Graph_i)

End Sub