Perform operation if today is the first of the month VBA

LambChoptheKid

New Member
Joined
Dec 10, 2022
Messages
35
Office Version
  1. 365
Platform
  1. Windows
Hello, I'm building a macro that will perform a data pulling operation each day when I run it. This part of the macro runs great. But, at the start of each month the data should be scrapped and the data storage worksheet should start again from zero.

The idea that I have is to bracket my function in an IF statement that checks to see if today is the first of the month and if it is, then delete data in rows 2-1500. I imagine that the delete function will be easy to work out on my own, but I am a bit lost as to how to see if today is the first of the month in VBA language.

Does anyone have any ideas or experience regarding this kind of thing?

Any help is greatly appreciated!

This is in Excel 365 btw
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
One way
VBA Code:
If Date = DateSerial(Year(Date), Month(Date), 1) Then
 
Upvote 1
Solution

Forum statistics

Threads
1,224,739
Messages
6,180,674
Members
452,993
Latest member
FDARYABEE

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