#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA

i've some questions in A1-A5, then someone must be answer all the question
weither Yes Or No (B1-B5), But if the answer is Yes, that people must explain
why the answer were Yes in (c1-c5). If they choose Yes, they need/must to
fill in column C1 and can't jump to other question.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA

Might be better to do in Access, but how about a userform that just keeps
coming back if the proper fields aren't filled out? You could throw a msgbox
in between to warn users that they need to provide a reason for all "yes"
answers.

....kurt

"olen" wrote in message
...
i've some questions in A1-A5, then someone must be answer all the question
weither Yes Or No (B1-B5), But if the answer is Yes, that people must
explain
why the answer were Yes in (c1-c5). If they choose Yes, they need/must to
fill in column C1 and can't jump to other question.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default VBA

Bit crude but it works

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B1:B5")) Is Nothing Then
With Target
.Offset(0, 1).Activate
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
Dim stemp As String

For Each cell In Me.Range("B1:B5")
If cell.Value = "Yes" And cell.Offset(0, 1).Value = "" And _
Target.Address < cell.Offset(0, 1).Address Then
stemp = stemp & cell.Address & vbNewLine
End If
Next cell
If stemp < "" Then
MsgBox "You must give reasons for Yes in : " & vbNewLine & _
stemp
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--
HTH

Bob Phillips

"olen" wrote in message
...
i've some questions in A1-A5, then someone must be answer all the question
weither Yes Or No (B1-B5), But if the answer is Yes, that people must

explain
why the answer were Yes in (c1-c5). If they choose Yes, they need/must to
fill in column C1 and can't jump to other question.



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



All times are GMT +1. The time now is 06:27 AM.

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

About Us

"It's about Microsoft Excel"