at msgbox: compile error left hand side of assignment must return variant or object.
Assume there is a list of names beginning at A1 in the activesheet of the current workbook. The names are in uppercase letters in normal format such as CARRIE F. LEE. This sub is supposed to count the number of people with the name LEE and display it in a message box.
I have a code but there is an error!
What am I doing wrong? Any help is appreciated. Thank you!
Dim leeName As String
Dim count As Integer
count = 0
Do Until .Offset(0, 0).Value = ""
leeName = .Offset(0, 0).Value
If Len(leeName) >= 4 Then
If Right(leeName, 3) = "LEE" And Mid(leeName, leeName, (3 - 1)) = " " Then
count = count + 1
MsgBox = "There are " & count & " people whose last name is Lee."