Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
Using code below as basis?
VBA Code:
Option Explicit
Sub FillDates()
Dim wb As Workbook
Dim ws As Worksheet
Dim FCell As Range
Dim LCell As Range
Dim LRow As Long
Set wb = Workbooks("DailyMail.xlsx")
Set ws = wb.Worksheets("Daily Mail Update")
Set FCell = ws.Range("A2")
Set LCell = ws.Range("A2" & LRow)
LRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
If Not Date = Application.WorkDay(DateSerial(Year(Date), Month(Date), 0), 1) Or _
Date = Application.WorkDay(DateSerial(Year(Date), Month(Date), 0), 2) Then
FCell.Clear
FCell = Evaluate("Workday(EOMonth(Now(),-1),1)")
With FCell
.HorizontalAlignment = xlCenter
.NumberFormat = ("dd/mm/yy")
End With
End If
End Sub