phillipjpalmer1983
New Member
- Joined
- Nov 21, 2017
- Messages
- 3
Hello
I need some help with an input box.
The box is a simple user form with 2 fields, Job and Comment and a submit button.
When the user fills in the form and hits submit, the values are written to a sheet in columns, labelled Job and Comment.
It works fine, however, i want the form to first check if the job value already exists and if so, overwrite the comment with the new comment.
Logically, i think when the user submits, it should search based on the job.value and if it find it then overwrite the adjacent comment otherwise create a new job and comment row. I just cant work out how do this in VBA.
Help please.
Here is my code so far:
Private Sub Submit_Click()
Sheets("Comments").Select
Range("A2").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 0).Value = Me.Job.Value
ActiveCell.Offset(0, 1).Value = Me.Comments.Value
Me.Hide
Worksheets("WIP").Activate
End Sub
I need some help with an input box.
The box is a simple user form with 2 fields, Job and Comment and a submit button.
When the user fills in the form and hits submit, the values are written to a sheet in columns, labelled Job and Comment.
It works fine, however, i want the form to first check if the job value already exists and if so, overwrite the comment with the new comment.
Logically, i think when the user submits, it should search based on the job.value and if it find it then overwrite the adjacent comment otherwise create a new job and comment row. I just cant work out how do this in VBA.
Help please.
Here is my code so far:
Private Sub Submit_Click()
Sheets("Comments").Select
Range("A2").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 0).Value = Me.Job.Value
ActiveCell.Offset(0, 1).Value = Me.Comments.Value
Me.Hide
Worksheets("WIP").Activate
End Sub