Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Running Conditional If-then script off a command box

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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Running Conditional If-then script off a command box

Thank you for responding. I am attempting to create a multi-paged survey
through Excel. Page One contains 7 questions that the user must answer via
Active X Combo Boxes. I linked the combo boxes to cells in the same sheet.
When the user answers a question, the text appears in the linked cells. All
the linked cells are in the same column (S11:S20).

"jhyatt" wrote:

is it all in one column. how many questions or how many cells are you looking
at

"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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Running Conditional If-then script off a command box

sorry forgot to add this to the end of the code

Worksheets("sheet2").Range("b4").Activate


  #4   Report Post  
Posted to microsoft.public.excel.programming
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!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Running Conditional If-then script off a command box

is it all in one column. how many questions or how many cells are you looking
at

"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!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Running Conditional If-then script off a command box

I will give this a shot. Thank you!

"jhyatt" wrote:

sorry forgot to add this to the end of the code

Worksheets("sheet2").Range("b4").Activate


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Running Conditional If-then script off a command box

this should do the trick

Sub AnswerQuestion()
Worksheets("Sheet1").Range("b1").Activate
If ActiveCell.Value = "" Then
MsgBox "All questions must be answered"
Worksheets("Sheet1").Range("b1").Activate
End If
Worksheets("Sheet1").Range("b4").Activate
If ActiveCell.Value = "" Then
MsgBox "All questions must be answered"
Worksheets("Sheet1").Range("b4").Activate
Else
ActiveWorkbook.Sheets("sheet2").Activate
Worksheets("Sheet2").Range("b1").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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems running a dos program from vba script Reh Excel Programming 7 November 27th 06 10:20 PM
Running a Script upon Saving a File Michael Excel Programming 3 September 12th 05 07:36 PM
running vbs script from vba? John Gunn Excel Programming 1 November 13th 04 01:08 AM
Compile error when running a vba script. AB Robbins Excel Programming 3 October 14th 04 01:56 PM
Running a VB Script Sofia Katchi Excel Programming 2 July 17th 03 03:22 PM


All times are GMT +1. The time now is 12:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"