Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
12/29/2004 1:44:20 PM EDT
I want to have an input cell so that whatever is in that cell is inserted into the replace portion of a dialog box. However, when I use Ctrl+V in the macro, it takes the current contents only. Therefore, if I change the value of the input cell and run the macro again, it still uses the original contents of the cell.

This is the section of code in question:

Selection.Replace What:="$Z", Replacement:="$AA", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


Can anyone help me out? Thanks.
12/29/2004 1:49:47 PM EDT
[#1]
huh?

Are you saying you want to be able to highlight any particular cell, start the macro and have it put that active cell's value into the replace portion of the search & replace function?

If that's the case then you're really making it too difficult, I think.  Just create a visible button for the Replace... function and CTRL+C, CTRL+V, baby.
12/29/2004 2:28:06 PM EDT
[#2]
I want to have an input cell so that whatever is in that cell is inserted into the replace portion of a dialog box.  However, when I use Ctrl+V in the macro, it takes the current contents only.  Therefore, if I change the value of the input cell and run the macro again, it still uses the original contents of the cell.

Any suggestions?
12/29/2004 4:30:32 PM EDT
[#3]
BTT
12/29/2004 4:43:09 PM EDT
[#4]
Do a VLOOKUP!
12/29/2004 5:25:12 PM EDT
[#5]
This will replace any cell on this sheet that has a value of cell Z1 with the value of cell AA1.  Is this what you were trying to do?

Sub Macro1()
Cells.Replace What:=Range("Z1"), Replacement:=Range("AA1")
End Sub