This question has been asked probably million times, but I must be doing something wrong as my logical code does not work correct and I can't understand why.
I have two conditions:
oObjectSearchResults.Count = 0ThisWorkbook.Worksheets("Data").Range("Z2").Value = "1"
I need it work like:
IF oObjectSearchResults.Count = 0 and ThisWorkbook.Worksheets("Data").Range("Z2").Value = ""
Then Do process
IF oObjectSearchResults.Count = 1 and ThisWorkbook.Worksheets("Data").Range("Z2").Value = "1"
Then Do process
Else Msgbox ("There is already file with name blabla, use already existing one")
Here is my code:
If oObjectSearchResults.Count = 0 And ThisWorkbook.Worksheets("Data").Range("Z2").Value = "" Then
'Do process
If oObjectSearchResults.Count = 1 And ThisWorkbook.Worksheets("Data").Range("Z2").Value = "1" Then
'Do process
Else
Msgbox ("There is already file with name blabla, use already existing one")
End If
End If