I have a lite problem with some statement in my code. the situation is like this: I am working with UserForm in excel based on selection of months and the data goes to my report from another report. To analyze data of certain month we need data of the month before. So for January we need data from last's year database for December. I made special sub just in case we need to analyze data about January and we need the old database too. And with that statment I have a problem and I get that error "VBA End If without block If Error" :
'If the month that was selected is January then we need to open old Visual file Month
If MonthName = Lists.Range("A2").Value Then 'it means January
Call January
Else
For Each ws In Worksheets
If ws.Name = "December" Then
Sheets("December").Delete
End
End If
Next ws
End If
Please, can someone help?
MonthName) as variable names. (I don't think that would cause the "End If without block If" error though - that sounds more like one of yourIfstatements was written as a single-lineIfbut you still wrote anEnd Iffor it, but your posted code doesn't show that.)