ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   View Row Data in UserForm / Edit (https://www.excelbanter.com/excel-programming/279915-view-row-data-userform-edit.html)

Pete T[_2_]

View Row Data in UserForm / Edit
 
I have an UserForm which staff uses to initiate entries on a
WorkSheet. I now need to activate that same UserForm and populate the
fields with data from a selected row, so staff can edit enties.

If I click on a Cell in a row of data, how do I:

1. Capture the row number for use in the formula - say R is Rows
UserForm.ADate.Value = Worksheets("Contacts").Cells(R,2).Value

2. Load the UserForm with that data from the selected Row.

That's enough for now. Appreciate any directions.

steve

View Row Data in UserForm / Edit
 
Pete,

Private Sub UserForm_Initialize()
TextBox1.ControlSource = "$A$" & ActiveCell.Row
TextBox2.ControlSource = "$B$" & ActiveCell.Row
End Sub

will tie the Textbox1 to cell A and row. Now any changes to the text box
will input directly to the cell and anything that is already in the cell
will
appear in the textbox.
Complete the sub with all your objects.

Then use UserForm1.Show in your macro.

--
sb
"Pete T" wrote in message
om...
I have an UserForm which staff uses to initiate entries on a
WorkSheet. I now need to activate that same UserForm and populate the
fields with data from a selected row, so staff can edit enties.

If I click on a Cell in a row of data, how do I:

1. Capture the row number for use in the formula - say R is Rows
UserForm.ADate.Value = Worksheets("Contacts").Cells(R,2).Value

2. Load the UserForm with that data from the selected Row.

That's enough for now. Appreciate any directions.





All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com