Updating a Trend Tabsheet from a total of another sheet

EmilVictor

New member
Joined
Oct 15, 2018
Messages
5
Reaction score
0
Points
0
Excel Version(s)
2012
Hello,

I need to update my trend tab based from the total of the sales tab.

next month i need to update again with another month but i still need the history sales.

is there a way to automatically update in based on a blank cell every month?

attached.

thanks,
 

Attachments

  • Test.xlsx
    28.4 KB · Views: 18
Do you have any information about the sales date in the sales tab? It looks like there are a lot of blanked out columns to the left of the numbers. If you have the date a sumif or averageif function should do the trick.
 
I manage to have a code.

Sub Button1_Click()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Sheet1")
Set pasteSheet = Worksheets("Sheet2")
copySheet.Range("F3:I3").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub


=IF(I:I="Total",M148,0)


so if I find the cell value total then it will give me the Column M


then I can easily edit that with my MACRO.

will an IF formula do?

a sumif will not be effective because there are times that our data has negative and that don't total when you sum it. so I need to get the last Cell which is "total amount for every criteria"
 
If you just want to get the last (or 2nd to last) number, maybe this will work? Start on the cell on the trend tab where you want the number to go.

Sub GetTotal()
Sheets("Sales").Select
ActiveCell.Offset(-147, 0).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.Copy
Sheets("Trend").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 
Back
Top