OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Thanks in advance, I will try to give feedback for any potential solutions given.
This code was working, but I now get error "Compile error: Method or Member Data not Found"
This code was working, but I now get error "Compile error: Method or Member Data not Found"
Code:
Sub CheckSht()
Dim FirstDate As String
Dim Sheet As Sheets
'_____________________________________________________________________________________________
'Make a copy of "Sheet1" sheet.
'Get the date of the first one
Sheets("Sheet1").Activate
FirstDate = Format(Range("E2").Value, "YYYY.MM.DD")
'Check to see if the sheet exists and if so, terminate the program
'If ActiveSheet.Name = "Sheet1" & "." & FirstDate
For Each Sheet In ActiveWorkbook.Worksheets
If Sheet.Name = "Sheet1" & "." & FirstDate Then
MsgBox "The Worksheet " & """Sheet1." & FirstDate & """ already exists!"
Exit Sub
ElseIf Sheet.Name = "Sheet2" & "." & FirstDate Then
MsgBox "The Worksheet " & """Sheet2." & FirstDate & """ already exists!"
Exit Sub
End If
Next Sheets
'Make a copy of the sheet and name it
Sheets("Sheet1").Copy After:=Sheets("Sheet1")
ActiveSheet.Name = "Downloaded.EDDs" & "." & FirstDate
End Sub