Field validation via control button?

E

ExcelNoviceGuy

Hey all,

I've created a survey in an Excel workbook which groups questions by
theme on different worksheets. The user moves between sheets via
control buttons. Is it possible to add to the macro of each button
code will check for completeness / no null values for question
responses on the current worksheet before allowing the user to move to
the next worksheet?
 
S

Steve Smallman

Basically,

Yes.

you need to check each cell containing a response, compile a response
string, and then use MsgBox to prompt the user to complete the cells.

eg.

Sub cmdNext_Click()
msg=""
If Range("A2")="" then
msg=msg & vbcrlf &"Cell A2"
End if
If Range("C2")="" then
msg=msg & vbcrlf &"Cell C2"
end if
.......
If msg<>"" then
msg="This Page is incomplete, please enter responses in:"
msgbox(msg)
else
your code to move to next page
end if
end sub
 
T

Tom Ogilvy

Possibly. If your code is controlling the move, then don't move if you
find a question unanswered.
 

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