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)
 
Joined
Dec 17, 2008
Messages
5
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top