Find the given value from the on a column of table then replace it with the value that was given on a cell, its like Find and replace

mark692

Active Member
Joined
Feb 27, 2015
Messages
321
Office Version
  1. 2016
Platform
  1. Windows
i guys can you help me on my problem, I need a code that will find the number given on cell D2 on the column number and replace it with the value from cell D3. Here is the table below

Book1
ABCDEFGHI
1
2Value To Replace11111Group Letternumber
3New Value123A11111
4B6546
5C1561
6E65198494
7F9191
8G1616
9H13211
10I89849
11J11111
12K165132
13L1651
14M98491
15N1651
16O11111
17P98495
18A5944
19B126151
20C1111
21E1111
22F1561
23G1651
24H6894984
25I1111
Sheet1
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hope this helps.
VBA Code:
Sub sampple()
Dim LR As Long
LR = Cells(Rows.Count, 8).End(xlUp).Row
Range("H2").AutoFilter 2, Range("D2").Value
If WorksheetFunction.Subtotal(3, Range("H:H")) > 1 Then
    Range(Range("I3"), Cells(LR, 9)).Value = Range("D3").Value
End If
Range("H2").AutoFilter
End Sub
 
Upvote 0
its like Find and replace
Isn't it exactly Find/Replace?

VBA Code:
Sub FindReplace()
  Columns("I").Replace What:=Range("D2").Value, Replacement:=Range("D3").Value, LookAt:=xlWhole
End Sub
 
Upvote 0
Isn't it exactly Find/Replace?

VBA Code:
Sub FindReplace()
  Columns("I").Replace What:=Range("D2").Value, Replacement:=Range("D3").Value, LookAt:=xlWhole
End Sub
oh yes its find and replac, thank you this code works :)
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,218
Members
449,091
Latest member
jeremy_bp001

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