Hello,
I am receiving a run-time error 13 type mismatch for the code below. The error started when I saved the file with a new name and cleared out the names found in column A (names were in A9:A278). I would like to share my workbook with another organization and removed data to provide a blank template.
VBA Code:
sub auto_open()
Dim i As Long, j As Long
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In Sheets
sh.Unprotect "Test"
For i = 9 To sh.Range("A" & Rows.Count).End(3).Row
For j = 3 To sh.Cells(i, Columns.Count).End(1).Column Step 2
If Date > sh.Cells(i, j).Value Then
sh.Cells(i, j - 1).Resize(1, 2).Value = ""
End If
Next
Next
sh.Protect "Test", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=True
Next
End Sub
Line Error:
If Date > sh.Cells(i, j).Value Then
I am receiving a run-time error 13 type mismatch for the code below. The error started when I saved the file with a new name and cleared out the names found in column A (names were in A9:A278). I would like to share my workbook with another organization and removed data to provide a blank template.
VBA Code:
sub auto_open()
Dim i As Long, j As Long
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In Sheets
sh.Unprotect "Test"
For i = 9 To sh.Range("A" & Rows.Count).End(3).Row
For j = 3 To sh.Cells(i, Columns.Count).End(1).Column Step 2
If Date > sh.Cells(i, j).Value Then
sh.Cells(i, j - 1).Resize(1, 2).Value = ""
End If
Next
Next
sh.Protect "Test", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=True
Next
End Sub
Line Error:
If Date > sh.Cells(i, j).Value Then