I need to know if a sheet already exists, if it exists I want to be able to replace it.
If it does not exist then create it.
On Error Resume Next
Set sht = ThisWorkbook.Sheets("someSheet")
On Error GoTo 0
When I use the above I can use the below if the sheet already exist
If Not sht Is Nothing Then
else
end if
But if it does not exist sht
becomes empty and the if fails, displaying Run-time Error 424: Object Required
.
How can I set up a if else to know whether the sheet exists or not?