Hello,
I have a question that involves moving and deleting data from a listbox.
I use below code to update data in a userform listbox, this works perfect.
I want to add an extra function that when I mark the data as "finished" that the selected row will be moved to a new location.
When I open the userform the listbox is populated with a named range "Action24hrOpen", all the rows have an ID number. (column A)
The data is in column b/c/d/e/f.
When I mark the data as finished column E will get a "Yes" value, otherwise it is "No"
when it is marked "Yes", I would like that data to be moved to columns i/j/k/l/m on the same sheet.
The range for that location is called "Action24hrDone"
So when marked a row has "Yes" in column "E", that row needs to be moved to the new location
Could some one please help me make this possible ?
Thanks in advance.
I have a question that involves moving and deleting data from a listbox.
I use below code to update data in a userform listbox, this works perfect.
I want to add an extra function that when I mark the data as "finished" that the selected row will be moved to a new location.
When I open the userform the listbox is populated with a named range "Action24hrOpen", all the rows have an ID number. (column A)
The data is in column b/c/d/e/f.
When I mark the data as finished column E will get a "Yes" value, otherwise it is "No"
when it is marked "Yes", I would like that data to be moved to columns i/j/k/l/m on the same sheet.
The range for that location is called "Action24hrDone"
So when marked a row has "Yes" in column "E", that row needs to be moved to the new location
Could some one please help me make this possible ?
Thanks in advance.
VBA Code:
Private Sub cmb_Update24HrAction_Click()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("24 Hr_Long Term_DMS3")
Dim Selected_row_email As Long
Selected_row_email = Application.WorksheetFunction.Match(CLng(Me.txt_24hrAction_ID.value), sh.Range("A:A"), 0)
Me.cb_24hrActionFinished.Visible = False
If Me.txtNew24hrAction.value = "" Then
MsgBox "Problem area cannot be empty"
Exit Sub
End If
'-----------------------------------------------------------
sh.Range("B" & Selected_row_email).value = Me.txtNew24hrAction.value
sh.Range("C" & Selected_row_email).value = Format(Me.txtNew24hrName.value, "mmm dd, yyyy")
sh.Range("D" & Selected_row_email).value = Me.txtNew24hrDate.value
If cb_24hrActionFinished = True Then
sh.Range("E" & Selected_row_email).value = "Yes"
sh.Range("F" & Selected_row_email).value = Format(Now, "mmm dd, yyyy")
Else
sh.Range("E" & Selected_row_email).value = "No"
sh.Range("F" & Selected_row_email).value = Empty
End If
'-----------------------------------------------------------
Me.txtNew24hrAction.value = ""
Me.txtNew24hrName.value = ""
Me.txtNew24hrDate.value = ""
Me.txt_24hrAction_ID = ""
Me.Label9.Caption = "Enter a NEW 24 Hr Action"
cmb_Add24HrAction.Visible = True
cmb_Update24HrAction.Visible = False
Me.cb_24hrActionFinished.Visible = False
'-----------------------------------------------------------
Call Refresh_24hrAction
End Sub