Formula for Lookup and replace

Cozzy123

New Member
Joined
Aug 10, 2016
Messages
14
Hi all,

I wonder if this is possible. I have userforms used to capture data into a table, I then have a search via listboxrow to find specific rows of data to view. This all works really well and nicely.

What I want to do is edit some of the data from the search that I have found and place the edited data back into the original table. Can this be done?

either via excel sheets or VBA? As you can imagine my tables/search are excel and the userforms are used to input the data and view the data. The sheets are in the background hidden.

Cheers
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
In principle ...

1. Find the data row( r ) - you say your code already does this
2. Open userform (for data edit)
3. Write data from row r into boxes on a userform
Code:
TextBox1.Value = Sheets("Data").Cells([COLOR=#ff0000]r[/COLOR] , "A") 
etc
4. Amend fields in the userform
5. Click button to write amended data back to original cells (and clear userform)
Code:
Sheets("Data").Cells([COLOR=#ff0000]r[/COLOR] , "A") = TextBox1.Value
 
Last edited:
Upvote 0
Thank you for taking the time to respond, so it sounds as it if it can be done, great!

What my code does is vlookup the text in a textbox and puts the values into other textboxs along the row via vlookup. Probably a rubbish way of doing it but it seems to work.

I'll give it a go tomorrow, and report back.

thanks again.
 
Upvote 0
Thanks again, I have tried this as this was my very old anc basic coding. The first part works fine:

Sheets("Table").Range("y1") = TextBoxchcrn
TextBoxchcr.Value = Application.WorksheetFunction.VLookup(Sheets("Table").Range("y1"), Sheets("Table").Range("A2:x2000"), 5, False)

Trying to edit after writing new text in the textbox, I reversed the above so:

Sheets("Table").Range("y1") = TextBoxchcrn
Application.WorksheetFunction.VLookup(Sheets("Table").Range("y1"), Sheets("Table").Range("A2:x2000"), 5, False) = TextBoxchcr.Value

but doesn't work? Obviously this doesn't work. So, how would I change my code to fit what you have above?

Regards
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

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