Edit User Form

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings,

I nearly have this completed. The User form works great for input, and deletion. The problem now is the edit, and it is only the date column. When I select my row on my form to edit the cells get populated but the Date Cell is incorrect. I provided my current macro. Columns 2 through 4 I know without a doubt are correct. Its is the first Column. I've been moving things around and still cannot get it to work. Any suggestions would be great. I originally had the line
Excel Formula:
Me.date.Value = Me.lstactivity.List(Me.lstactivity.ListIndex, 1)
and everything shifted to the left on the form, so the weight column was blank. That is how I know it is the date I need to put right.


VBA Code:
Private Sub cmdEdit_Click()
If Selected_list = 0 Then

MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"

Exit Sub
End If

'code to update the value of respective controls
Me.txtRowNumber.Value = Selected_list + 1

.Value = CDate(Me.Txtdate) = Me.lstactivity.List(Me.lstactivity.ListIndex, 1)
Me.Txtmission.Value = Me.lstactivity.List(Me.lstactivity.ListIndex, 2)
Me.Cmbmode.Value = Me.lstactivity.List(Me.lstactivity.ListIndex, 3)
Me.Cmbdenton_fms.Value = Me.lstactivity.List(Me.lstactivity.ListIndex, 4)
Me.Txtweight.Value = Me.lstactivity.List(Me.lstactivity.ListIndex, 5)
MsgBox "Please make the required changes and click on 'Save' button to update,", vbOKOnly + vbInformation, "Edit"


End Sub

Thank you,
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Thank you for those who reviewed this. I had to change the first line to read
Excel Formula:
Me.Txtdate.Value = Me.lstactivity.List(Me.lstactivity.ListIndex, 0)
and with each subsequent line I had to reduce the number by one. I will say it is strange that the date presented back to the user form was the Excel five digit number for the date. That is weird; not too worried because a new date will be put in and saved properly.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top