ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   how can i re-populate a userform with data already entered? (https://www.excelbanter.com/new-users-excel/127387-how-can-i-re-populate-userform-data-already-entered.html)

Paul Dye

how can i re-populate a userform with data already entered?
 
I have many lines of data and would like to use the input form to recall the
data based on a search so that i can re-enter incorrect data. I have limited
VBA experience

JLatham

how can i re-populate a userform with data already entered?
 
Paul,
When you say "input form" are you actually talking about the gray box type
user forms that have text/numeric entry areas on them and maybe a command
button that causes the entered information to be put onto a worksheet?

If that's the case, you can use that form as a template for another to
reverse the operation kind of. I do something similar with a file, and
rather than get complicated with searches and such, I have a text entry box
at the top of the form that asks for the row number that the information to
be edited is in on the sheet. The user enters that number and click a
command button, and the code then uses that row number to get the
information, kind of like this:

Sub CommandGetOldData_Click()
Me!textName = ActiveSheet.Range("A" & txtRowEntered).Value
Me!txtWage = ActiveSheet.Range("B" & txtRowEntered).Value
'... get all of the existing information from a row into the form's text boxes
End Sub

Then at the bottom, there is another button that when they click it takes
all of the information, changed or not on the form, and puts it back onto the
worksheet:
Sub CommandUpdateWithEdits_Click()
ActiveSheet.Range("A" & txtRowEntered).Value = Me!textName.Text
ActiveSheet.Range("B" & txtRowEntered).Value = Me!txtWage.Text
'...continue replacing old with new
End Sub

Let me know if I can help any more.
"Paul Dye" wrote:

I have many lines of data and would like to use the input form to recall the
data based on a search so that i can re-enter incorrect data. I have limited
VBA experience



All times are GMT +1. The time now is 02:42 AM.

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