ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find and update (https://www.excelbanter.com/excel-programming/388064-find-update.html)

Keith Teeter

find and update
 
I have created a user form that will put information into a
spreadsheet into the next available row. I am now trying to create a
function in that same userform that allows me to search a criteria and
to update that same userform with the information allready entered
previosly. once I find that information I want to be able to submit
the data back into the spreadsheet without creating a duplicate.


JLGWhiz

find and update
 
While the UserForm can have its own click event, it is normally used as
a container for other controls such as command buttons, list boxes,
combo boxes and other controls from the control tool box. Having said
that, you can use a couple of methods to do what you describe:

For Each cell In myRange
If cell = mySearchCriteria Then
myControl.Value = cell.Value '<<adds to control on form
End If

Or

With myRange
Set c = .Find(mySearchCriteria, LookIn:=xlValues)
If Not c Is Nothing Then
sRng = c.Address
myContolValue = Range(sRng).Value '<<Adds to control on form
End If
End With

As for the part about submitting it back to the spreadsheet without
creating a duplicate...I guess I don't understand what you mean.




"Keith Teeter" wrote:

I have created a user form that will put information into a
spreadsheet into the next available row. I am now trying to create a
function in that same userform that allows me to search a criteria and
to update that same userform with the information allready entered
previosly. once I find that information I want to be able to submit
the data back into the spreadsheet without creating a duplicate.




All times are GMT +1. The time now is 05:04 AM.

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