Hi,
I have the code
inserted into module and in the sheet itself I have the code
.
However, my code only works for case1 when the cell has "iteration status" and not for the other values. But I can't see why I it not running for the other 2 cases . Thanks in advanced for your help.
I have the code
Code:
Sub Iteration_Status()Dim response As Variant
'input box that can accept both text and numbers
response = Application.InputBox("Enter Iteration Status Number", "Numbers Only", , , , , , 1 + 2)
If response = "False" Then
'code distinguishes between "False" on clicking the Cancel button as compared to "False" entered in the input box as a string value which returns 0
MsgBox "Cancel has been pressed"
ElseIf response = "" Then
MsgBox "A zero-length string ("") has been entered"
Else
'reurns "0" (zero) both if either "0" is entered in input box or "False" is entered in input box
MsgBox response, vbOKCancel
End If
ActiveCell.Value = "IT" & response
End Sub
Sub Rework_Status()
Dim response As Variant
'input box that can accept both text and numbers
response = Application.InputBox("Enter Rework Status Number", "Numbers Only", , , , , , 1 + 2)
If response = "False" Then
'code distinguishes between "False" on clicking the Cancel button as compared to "False" entered in the input box as a string value which returns 0
MsgBox "Cancel has been pressed"
ElseIf response = "" Then
MsgBox "A zero-length string ("") has been entered"
Else
'reurns "0" (zero) both if either "0" is entered in input box or "False" is entered in input box
MsgBox response, vbOKCancel
End If
ActiveCell.Value = "REW" & response
End Sub
Sub Rebrief_Status()
Dim response As Variant
'input box that can accept both text and numbers
response = Application.InputBox("Enter Rebrief Status Number", "Numbers Only", , , , , , 1 + 2)
If response = "False" Then
'code distinguishes between "False" on clicking the Cancel button as compared to "False" entered in the input box as a string value which returns 0
MsgBox "Cancel has been pressed"
ElseIf response = "" Then
MsgBox "A zero-length string ("") has been entered"
Else
'reurns "0" (zero) both if either "0" is entered in input box or "False" is entered in input box
MsgBox response, vbOKCancel
End If
ActiveCell.Value = "REB" & response
End Sub
Code:
Private Sub Worksheet_Change(ByVal Target As Range)If Not Intersect(Target, Range("F7")) Is Nothing Then
Select Case Range("F7")
Case "Iteration Status": Iteration_Status
Case "Rework Status": Rework_Status
Case "Rebrief Status": Rebrief_Status
End Select
End If
End Sub
However, my code only works for case1 when the cell has "iteration status" and not for the other values. But I can't see why I it not running for the other 2 cases . Thanks in advanced for your help.