Hello All,
I don't work with VBA coding terribly much. What I am trying to do is require a note to be entered in the notes column (see attached spreadsheet) when disability is selected as the status. I have the VBA code good all the way to the point of the note, but even though it says Enter comment in H* (H is the beginning of the notes column), when the note is put in it enters it in column E and not H. I have entered the code I am using below. Thank you for any help and your expertise.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Rows.Count > 1 Or Target.Columns.Count > 1 Then
Exit Sub
End If
Dim com As String
Dim comm1 As String
'Specify the range below. Set single column range else the code will error out
Set isect = Application.Intersect(Target, Range("D11:D62"))
If isect Is Nothing Then
Else
If Target.Value = "Disability" Then
com = "Enter comment in " & Target.Offset(0, 4).Address(RowAbsolute:=False, columnabsolute:=False)
Do While comm1 = ""
comm1 = Application.InputBox(prompt:=com, Type:=2)
On Error GoTo myloop
If comm1 = False Then
comm1 = ""
End If
myloop:
On Error GoTo -1
Loop
Target.Offset(0, 1).Value = comm1
Else
Target.Offset(0, 1).Value = "" 'Remove this line if not desired
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Bookmarks