jo15765
06-12-2012, 06:40 PM
Hello All...If I am not detailed enough here (or if anyone has any questions pertaining to this, please let me know :) )
Public Sub Trying()
Dim sup As String
Dim rName() As Variant
Dim Pre() As Variant
Dim q As String
Application.DisplayAlerts = False
sup = "Joseph"
Pre = Array("Alpha", "Omega")
rName = Array("Test1", "Test2")
If Not IsEmpty(Pre) And Not IsEmpty(rName) Then
If UBound(Pre) = UBound(rName) Then
For q = LBound(rName) To UBound(rName)
Call DailySales(CStr(rName(q)), sup, CStr(Pre(q)))
Call WeeklySalesTotal(Cstr(rName(q)), sup, CStr(Pre(q)))
Next q
End If
End If
End Sub
In DailySales in cell D17, there is a Dollar amount. I was wondering if there was a way to store that in a variable, let's say TOTAL, then once WeeklySalesTotal is opened compare the value in TOTAL to the last row with data in column G. Then once the line Next q is hit set Total = 0 or null (whatever it would be to clear a value) then when the 2nd workbook in rName is opened do the same process (store D17 in the variable TOTAL)
***One thing I thought of is I am wanting to store the value in a variable, because the 1st workbook is closed when the 2nd workbook is opened. I have seen multiple posts on how to compare two opened workbooks, but haven't been able to find anything similar to what I want to do.
Public Sub Trying()
Dim sup As String
Dim rName() As Variant
Dim Pre() As Variant
Dim q As String
Application.DisplayAlerts = False
sup = "Joseph"
Pre = Array("Alpha", "Omega")
rName = Array("Test1", "Test2")
If Not IsEmpty(Pre) And Not IsEmpty(rName) Then
If UBound(Pre) = UBound(rName) Then
For q = LBound(rName) To UBound(rName)
Call DailySales(CStr(rName(q)), sup, CStr(Pre(q)))
Call WeeklySalesTotal(Cstr(rName(q)), sup, CStr(Pre(q)))
Next q
End If
End If
End Sub
In DailySales in cell D17, there is a Dollar amount. I was wondering if there was a way to store that in a variable, let's say TOTAL, then once WeeklySalesTotal is opened compare the value in TOTAL to the last row with data in column G. Then once the line Next q is hit set Total = 0 or null (whatever it would be to clear a value) then when the 2nd workbook in rName is opened do the same process (store D17 in the variable TOTAL)
***One thing I thought of is I am wanting to store the value in a variable, because the 1st workbook is closed when the 2nd workbook is opened. I have seen multiple posts on how to compare two opened workbooks, but haven't been able to find anything similar to what I want to do.