Increment a specific cell based on time and date.

duskwood47

New Member
Joined
Oct 9, 2017
Messages
28
Ok so what I would like to do is create a macro that will allow me to create one specific spin control button that will increment a specific cell by one but that specific cell would be specified based on what time and what day it is.

I know I could use

Sub IncrementonFirst()

Dim MyDate As Date, MyDay As Integer



MyDate = Now

MyDay = Day(MyDate)

'establish the date and day



With ThisWorkbook.Worksheets("Sheet1")

If MyDay = 1 Then _

.Range("A1").Value = .Range("A1").Value + 1

End With



End Sub

To do it for the day and use a CASE SELECT or IF THEN ELSEIF for the days but Im not sure how to add in the time factor.


Any help would be appreciated.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Actually now that I read this code more carefully, this would only increment on the 1st of the month, is there a way to increment based on what day it is?
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,314
Members
453,032
Latest member
Pauh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top