Hi all !!!
I am just starting off with VBA and have made a couple of userforms, but ran into a question when trying to update the information based on multiple selections in a ListBox. I have a userform that shows in a list box all of the jobs that are due this week, if for some reason I do not receive the materials I want to change the status to pending. I had a combo box previously which updated the pertinent information, but going one by one was taking a long time and I decided to change to ListBox thinking the code would be the same but it is not working. The macro runs without debuging but it does not update the column to "Pending".
Here is my code as of now:
Private Sub CommandButton4_Click()
'Click to update the status of the jobs in the master job trail to say they are pending
g = 1
Do
DoEvents
g = g + 1
p = Sheets("Master Job Trail").Range("A" & g)
If p = ListBox1.Text Then
Sheets("Master Job Trail").Range("S" & g) = TextBox6.Text
End If
Loop Until p = ""
MsgBox "Worked was added as pending", vbInformation
ThisWorkbook.Save
Unload Pending
End Sub
I am just starting off with VBA and have made a couple of userforms, but ran into a question when trying to update the information based on multiple selections in a ListBox. I have a userform that shows in a list box all of the jobs that are due this week, if for some reason I do not receive the materials I want to change the status to pending. I had a combo box previously which updated the pertinent information, but going one by one was taking a long time and I decided to change to ListBox thinking the code would be the same but it is not working. The macro runs without debuging but it does not update the column to "Pending".
Here is my code as of now:
Private Sub CommandButton4_Click()
'Click to update the status of the jobs in the master job trail to say they are pending
g = 1
Do
DoEvents
g = g + 1
p = Sheets("Master Job Trail").Range("A" & g)
If p = ListBox1.Text Then
Sheets("Master Job Trail").Range("S" & g) = TextBox6.Text
End If
Loop Until p = ""
MsgBox "Worked was added as pending", vbInformation
ThisWorkbook.Save
Unload Pending
End Sub