VBA search and update help

Adam88

New Member
Joined
Dec 12, 2017
Messages
16
Hi,

Wasn't sure how to correctly title this question but here goes;

I would like to know how to find the contents of a cell (which I am currently doing with a worksheetfunction.Vlookup method), copy the contents to an integer (or other number) variable, add another integer to it (based on a userform textbox entry) and then paste the new value back into the original cell.

I can somewhat accomplish all apart from the last bit which is where I'm unsure of the correct approach.

Thanks
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Substitute your values for 25 and 100 in the code and change the search range to your actual range.
Code:
Sub t()
Dim xVal As Long, fn As Range
xVal = 25
Set fn = Range("A2:A100").Find(xVal, , xlValues) 'Range and values are arbitrary, require substitution
 If Not fn Is Nothing Then
     fn = xVal + 100
 End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,272
Members
448,558
Latest member
aivin

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