I need to update on exist ticket number on VBA in excel
However, I tried many times to bring the data from the sheet to combBox of Ticket number from "A2" to lastRow Addedd, but it tell me its wrong syntax.
How to take the value of CombBox? how to insert it in IF statement? please help me to make the following condition
- get the ticket number from Tickets sheet
- write the update value from combBox Close by and Ticket Status to both Ticket Sheet and remove them from PendingTickets sheet if the Ticket status is Solved or Closed
the code of test If the Ticket Status is Pending or On Progress
Dim Ws As Worksheet
Dim lastRow As Long
Dim openOn As Date
'Declare openBy to date Now function'
openOn = Now()
'set format function on time var'
openTimeAmPM = Format(openOn, "m.d.yy h:mm AM/PM")
'copy ticket data to Pending tickst sheet if the ticket status is Pending or On progress'
' If SieraForum.CombTicketStatus.Value = "Pending" Or "On Progress" Then
Sheets("PendingTickets").Cells(lastRow + 1, 1).Value = lastRow
Sheets("PendingTickets").Cells(lastRow + 1, 2).Value = SieraForum.txtTicketName.Value
ElseIf SieraForum.ErrorOption = True Then
Sheets("PendingTickets").Cells(lastRow + 1, 3).Value = "Error"
ElseIf SieraForum.OrderOption = True Then
Sheets("PendingTickets").Cells(lastRow + 1, 3).Value = "Order"
Sheets("PendingTickets").Cells(lastRow + 1, 4).Value = SieraForum.CombSeverity.Value
Sheets("PendingTickets").Cells(lastRow + 1, 5).Value = SieraForum.CombLocation.Value
Sheets("PendingTickets").Cells(lastRow + 1, 6).Value = SieraForum.txtTicketDetails.Value
Sheets("PendingTickets").Cells(lastRow + 1, 7).Value = SieraForum.CombOpenBy.Value
Sheets("PendingTickets").Cells(lastRow + 1, 8).Value = SieraForum.CombCloseBy.Value
Sheets("PendingTickets").Cells(lastRow + 1, 9).Value = SieraForum.CombTicketStatus.Value
Sheets("PendingTickets").Cells(lastRow + 1, 10).Value = openTimeAmPM
Else
MsgBox "The Ticket is Added Successfully"
End If
the Code of Save Button on Tap Update Ticket
Private Sub btnSave2_Click()
'declare close on date function'
Dim closeOn As Date
' set format function on time var'
closeOn = Now()
closeTimeAmPM = Format(openOn, "m.d.yy h:mm AM/PM")
'To enter new line'
lastRow = WorksheetFunction.CountA(Sheets("Tickets").Range("A:A"))
Sheets("Tickets").Cells(lastRow + 1, 1).Value = lastRow
Sheets("Tickets").Cells(lastRow + 1, 8).Value = SieraForum.CombCloseBy.Value
Sheets("Tickets").Cells(lastRow + 1, 9).Value = SieraForum.CombTicketStatus2.Value
'write the update statement'
'Sheets("Tickets").Cells(lastRow + 1, 12).Value = "Update Statement > " + SieraForum.txtTicketUpdate.Value
Sheets("Tickets").Cells(lastRow + 1, 11).Value = closeTimeAmPM
'Clear the data from the form'
SieraForum.CombTicketNum.Value = ""
SieraForum.CombCloseBy = ""
SieraForum.CombTicketStatus2 = ""
SieraForum.txtTicketUpdate.Value = ""
End Sub
Aucun commentaire:
Enregistrer un commentaire