Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
This code say`s runtime error 13??
VBA Code:
Sub FormatCells()
Dim wb As Workbook
Dim ws As Worksheet
Dim LRow As Long
Dim Rng As Range
Dim Cell As Range
Dim i As Long
Set wb = ActiveWorkbook
Set ws = wb.Sheets("Sheet")
LRow = Cells(Rows.Count, 1).End(xlUp).Row
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
With ws
Set Rng = ws.Range("F2:F" & LRow)
End With
For i = 2 To LRow
With Range("F" & i)
.NumberFormat = "dd/mm/yyyy"
.Value = DateValue(.Value)
End With
Next i
With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub