ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Field validation via control button? (https://www.excelbanter.com/excel-programming/279200-field-validation-via-control-button.html)

ExcelNoviceGuy

Field validation via control button?
 
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?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Steve Smallman

Field validation via control button?
 
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

"ExcelNoviceGuy" wrote in
message ...
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?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




Tom Ogilvy

Field validation via control button?
 
Possibly. If your code is controlling the move, then don't move if you
find a question unanswered.

--
Regards,
Tom Ogilvy

ExcelNoviceGuy wrote in message
...
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?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com