• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need to populate monthly sheet based on month #[code]&[/code]

abusarah

New Member
hi all,
i want to populate my "monthly" stats sheet, when i input the month and year in the reference cell and press the update button in "monthly" sheet. The "data" sheet is updated from the daily sheet when the user clicks the save button. This part is already done. just need to figure out how to match the specific month datas from dates.
 

Attachments

  • practice.xlsm
    38.7 KB · Views: 11
Hi,
Something like this?
See attached.
Never use merged cells when you are using VBA
I also changed your SAVE code.
First, it was not correct but above all avoid using Select and/or Activate, it slows down your code big time and it is rarely needed.
I added a column in your data sheet that compares the months and years with the month and year in your monthly sheet to populate your monthly sheet
For this question you also could use a pivot table.
 

Attachments

  • practice(belle).xlsm
    41.8 KB · Views: 4
hello
thanks for your help.
but when i delete the data and update data sheet with new data and then click update with a new month on monthly sheet, it does not work? what did i do?
 
If I understand the problem.
Second version should solve the problem.
 

Attachments

  • practice(belle)(v2).xlsm
    42 KB · Views: 9
Hi !
how to match the specific month datas from dates.
As always the easy way is an Excel feature (respecting the main rule TEBV)
needing a single codeline to copy data : an advanced filter !
Like any Excel beginner can yet achieve manually …
(As it removes the filters of the source table, tell me if you need to keep them.)
Code:
Private Sub Button1_Click()
    With Sheet4
        V = .[A2].Value:  If Not IsDate(V) Then Beep: Exit Sub
       .[C1:D2].Value2 = Evaluate("{""Date"",""Date"";"">=" & V & """,""<" & DateSerial(Year(V), Month(V) + 1, 1) & """}")
        Sheet3.ListObjects(1).Range.AdvancedFilter xlFilterCopy, .[C1:D2], .[A4:M4]
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Back
Top