replace with cell reference

dheeraj27

New Member
Joined
Mar 1, 2013
Messages
49
i want to replace things with reference of cell for example:-

Find value in B2
replace with value in C2

in whole sheet
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Select a single cell on your worksheet and activate the Replace dialog. Right click B2 and choose Copy. In the Find what box press Ctrl+v. Right click C2 and select Copy. In the Replace with dialog press Ctrl+v. Then click Replace All.
 
Upvote 0
TRY BELOW CODE
Code:
Sub Replace()
Dim old As Variant
old = Application.InputBox("Enter Value of Range-B2 Or Select")
Set ne = Range("C2")
If IsNumeric(old) Then
old = Int(Val(old))
Else
old = old
End If
For Each cell In ActiveSheet.UsedRange
If cell.Value = old Then cell.Value = ne.Value
Next
End Sub
 
Upvote 0
it is nt working...

it gives the pop-up to enter the value ,, but nthing happen after that. :(
can you pls provide data some and where are using this code bcoz this same code is working in mine file after i tried then given to you
 
Upvote 0
its working.. i was trying it wrong, i was nt entreing the value i put in B2 :p


i can u make it in the way.. when i can macro, it doest ask for input.. it change whatover B2 to C2...

i mean no inputbox
 
Upvote 0
its working.. i was trying it wrong, i was nt entreing the value i put in B2 :p


i can u make it in the way.. when i can macro, it doest ask for input.. it change whatover B2 to C2...

i mean no inputbox

if you dont want to put value in input box you can also select that cell using mouse or cursor
 
Upvote 0

Forum statistics

Threads
1,214,395
Messages
6,119,265
Members
448,881
Latest member
Faxgirl

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