Sub Save_Current_Day_Values()
Dim CurrentDay As Integer
Dim PredictedDemand As Single
Dim Temperature As Integer
Dim PricePerCup As Currency
Dim QuanLemonade As Currency
Dim QuanIcecubes As Integer
Dim QuanCups As Integer
Dim TotalQuantity As Integer
Dim CupsSold As Integer
Dim TotalSales As Integer
Dim TotalCosts As Currency
Dim TotalProfit As Currency
Dim iRowOffset As Integer
Dim iColOffset As Integer
iRowOffset = 4 'Set this variable equal to (row number in which day "1" appears) - 1
iColOffset = 0 'In case you move your table left or right, you can set this variable
'equal to (column number in which day "1" appears) - 1
'The two above variables can be useful when scaling a project. I choose to use them to
'so I can make use of the Cells(somerow, somecol) feature rather than
'Range(cellname). It seems like I'm taking the hard way to figuring this out, but
'in actuality I'm just cutting out the process that I'd need to take to locate which
'row to work on when specifying a day (and furthermore translating that row and column
'to a cellname).
Sheets("Daily_Performance").Select
'Saving all the cell values to temporary variables
With ActiveSheet
CurrentDay = .Range("B3")
PredictedDemand = .Range("E3")
Temperature = .Range("B5")
PricePerCup = .Range("E5")
QuanLemonade = .Range("E13")
QuanIcecubes = .Range("E14")
QuanCups = .Range("E15")
CupsSold = .Range("C20")
TotalSales = .Range("C21")
TotalCosts = .Range("C22")
TotalProfit = .Range("C23")
End With
'Writing all the cell values to History_Details
Sheets("History_Details").Select
With ActiveSheet
'Note: When using iColOffset + SomeNumber, set SomeNumber to (number of cells to the
'right of day "1") + 1
.Cells(iRowOffset + CurrentDay, iColOffset + 2) = Temperature
.Cells(iRowOffset + CurrentDay, iColOffset + 4) = PricePerCup
.Cells(iRowOffset + CurrentDay, iColOffset + 6) = CupsSold
.Cells(iRowOffset + CurrentDay, iColOffset + 12) = QuanCups
End With
End Sub