View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
jhyatt jhyatt is offline
external usenet poster
 
Posts: 61
Default Running Conditional If-then script off a command box

you could something like this just replace the cell value ie b1 with cells
that should contain the text.

Sub AnswerQuestion()
If b1 = "" Then
MsgBox "All questions must be answered"
Worksheets("Sheet1").Range("b1").Activate
ElseIf b4 = "" Then
MsgBox "All questions must be answered"
Worksheets("Sheet1").Range("b4").Activate
End If
End Sub

"Bucs85027" wrote:

I am trying to set up a command box that will do two things conditionally if
clicked. First, I want to run script that will validate that text is
present in a range of cells (all cells must have text values, although the
text values may vary). If all of the cells in the range contain text, then
the command button will take the user to the next sheet. If all the cells in
the range do not have text, the command button will spawn a message box
informing the user that all questions must be answered in order to continue.
If anyone can help with this, I would appreciate it! I have been trying to
figure this out for nearly a week!