ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Find and replace in a different cell (https://www.excelbanter.com/excel-worksheet-functions/215948-find-replace-different-cell.html)

PointerMan

Find and replace in a different cell
 
If my data looks like this and I want to pick a number and have the cell
under it filled with a number of my choosing, what's my best option?

A 10 20 30 40 50

B 25 35 45 55 65

C 15 20 25 30 35

Luke M

Find and replace in a different cell
 
Use VBA. Right click on sheet tab, view code, paste this in. Modify beginning
statements as desired.

Sub FindReplace()

'Value you want to find
xFind = 5
'Value you want to input
xReplace = 50
Cells.Find(What:=xFind, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Offset(-1).Value = xReplace
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"PointerMan" wrote:

If my data looks like this and I want to pick a number and have the cell
under it filled with a number of my choosing, what's my best option?

A 10 20 30 40 50

B 25 35 45 55 65

C 15 20 25 30 35



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

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