asked on
With Worksheets("Main Sheet").Range(copyRange)
Set c = .Find(Month0, LookIn:=xlValues)
Debug.Print Month0
If Not c Is Nothing Then
Debug.Print "xc" & CStr(c.Row)
Debug.Print Format(Worksheets("Main Sheet").Cells(c.Row, 8).Value, "yyyy/MM") & "mm" & Format(Worksheets("Month Status").Cells(i, 4).Value, "yyyy/MM")
If Trim(Format(Worksheets("Main Sheet").Cells(c.Row, 8).Value, "yyyy/MM")) <> "" Then
If Format(Worksheets("Main Sheet").Cells(c.Row, 8).Value, "yyyy/MM") = Format(Worksheets("Month Status").Cells(i, 4).Value, "yyyy/MM") Then
MsgBox "You cannot copy record of a closed month.", vbExclamation, "Month is closed!"
Exit Sub
End If
End If
End If
End With