Cakz Primz
Board Regular
- Joined
- Dec 4, 2016
- Messages
- 102
- Office Version
- 365
- Platform
- Windows
Guys,
I have data of ID number (cboSequence) in column B in Sheet1 formatting in number, such as 233, 1070 etc.
I have a userform to search based on ID number, so far the code is working
But when I am trying to edit and save the changes, it is not working.
Hope that someone can help to fix this problem.
Below the code of command button Save
Before I used this code:
Thank you
Prima
Indonesia
I have data of ID number (cboSequence) in column B in Sheet1 formatting in number, such as 233, 1070 etc.
I have a userform to search based on ID number, so far the code is working
But when I am trying to edit and save the changes, it is not working.
Hope that someone can help to fix this problem.
Below the code of command button Save
Before I used this code:
Code:
Private Sub cb_Save_Click()
answer = MsgBox("Are you sure want to save the record?", vbYesNo + vbQuestion, "save")
Dim lRow As Long, i As Long
lRow = Sheet1.Range("B5").CurrentRegion.Rows.Count
For i = 5 To lRow 'data start from row # 5
If Trim(Sheet1.Cells(i, 2)) = Trim(cboSequence.Text) Then 'cboSequence = ComboBox for ID number
cell.Offset(i, 40).Value = Me.cboSubGroup.Value
cell.Offset(i, 41).Value = Me.cboLocation.Value
End If
Next
End Sub
VBA Code:
Private Sub cb_Save_Click()
answer = MsgBox("Are you sure want to save the record?", vbYesNo + vbQuestion, "save")
Dim lRow As Long, i As Long
lRow = Sheet1.Range("B5").CurrentRegion.Rows.Count
For i = 5 To lRow 'data start from row # 5
If Trim(Sheet1.Cells(i, 2)) = Int(cboSequence.Value) Then
cell.Offset(, 3).Value = Me.cboSubGroup.Value
cell.Offset(, 4).Value = Me.cboLocation.Value
End If
Next
End Sub
Thank you
Prima
Indonesia