Advertisement
YasserKhalil2019

T4363_Count Items SUM Total By Sheet Name As Date

Nov 27th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. https://excel-egy.com/forum/t4363
  2. ---------------------------------
  3.  
  4. Sub Count_Items_SUM_Total_By_Sheet_Name_As_Date()
  5. Dim ws As Worksheet, sDate As String, lr As Long, c As Long
  6.  
  7. Application.ScreenUpdating = False
  8. Set ws = ThisWorkbook.Worksheets("Sheet1")
  9. ws.Range("D7:L8").ClearContents
  10. sDate = Format(ws.Range("H3").Value2, "dd-mm-yyyy")
  11. If Evaluate("ISREF('" & sDate & "'!A1)") = False Then Exit Sub
  12.  
  13. With ThisWorkbook.Worksheets(sDate)
  14. lr = .Cells(Rows.Count, "C").End(xlUp).Row
  15. For c = 4 To 12
  16. ws.Cells(7, c).Value = Application.WorksheetFunction.Count(.Range(.Cells(7, c), .Cells(lr - 1, c)))
  17. ws.Cells(8, c).Value = .Cells(lr, c).Value
  18. Next c
  19. End With
  20. Application.ScreenUpdating = True
  21. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement