type mismatch error

Joined
Sep 22, 2008
Messages
1
Reaction score
0
the code is this

Private Sub OKButtton_Click()
Sheets("Sheet1").Activate
NextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
Application.WorksheetFunction.CountA (Range("A:A")) + 1
Cells(NextRow, 1) = TextName.Text
If OptionHS Then Cells(NextRow, 2) = "High School"
If OptionCollege Then Cells(NextRow, 2) = "College"
If OptionGrad Then Cells(NextRow, 2) = "Grad School"
TextName.Text = ""
TextName.SetFocus
End Sub

i am getting type mismatch error when i run this macro.


help in this regard.

Thanks.(e-mail address removed)
 
this line

Application.WorksheetFunction.CountA (Range("A:A")) + 1

is the suspect. It's only a function (returning a value incremented by 1) but there is nothing to assign it to. I would comment that like out or delete it, because it looks like you are performing identical computation in the line directly above it.
 
Back
Top