Number of records for last 7 days
On Sat, 16 Jul 2016 20:53:24 +0000, R D S wrote:
On Sat, 16 Jul 2016 22:14:53 +0200, Claus Busch wrote:
Hi,
Am Sat, 16 Jul 2016 19:47:18 -0000 (UTC) schrieb R D S:
I have a spreadsheet with a column of dates, I would like a textbox on
a form display the number of records in the last x days.
your dates in Sheet1 column A:
Private Sub UserForm_Initialize()
Dim x As Long, days As Long, period As Long
x = 12 period = Date - x days =
Application.CountIf(Sheets("Sheet1").Range("A:A"), "=" & period)
TextBox1.Text = days End Sub
Regards Claus B.
That's fantastic thanks.
Now how about similar to return month so far?
As we put records on the spreadsheet AA3 has the date of the last one
entered, so this seems to have sorted it.
monthsofarperiod = Date - (Left(Range("AA3"), 2))
monthday = Application.CountIf(Range("AA3:AA1000"), "=" &
monthsofarperiod)
txtMonthSoFar.Text = monthday
|