I tried using this macro from what I found on the internet and it does nothing. I am looking to change the cell reference in a formula in nine columns. I set up a table for this macro to draw from such as this...
[TABLE="width: 96"]
<colgroup><col width="64" style="width: 48pt;" span="2"> <tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Find[/TD]
[TD="width: 64, bgcolor: transparent"]Replace[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$M
[/TD]
[TD="bgcolor: transparent"]$Q[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$N[/TD]
[TD="bgcolor: transparent"]$R[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$O[/TD]
[TD="bgcolor: transparent"]$S[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$P[/TD]
[TD="bgcolor: transparent"]$T[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$Q[/TD]
[TD="bgcolor: transparent"]$U[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$R[/TD]
[TD="bgcolor: transparent"]$V[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$S[/TD]
[TD="bgcolor: transparent"]$W[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$T[/TD]
[TD="bgcolor: transparent"]$X[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$U[/TD]
[TD="bgcolor: transparent"]$Y[/TD]
[/TR]
</tbody>[/TABLE]
I checked in the other worksheet and nothing was changed there and nothing was done in the worksheet that this table and the columns with the formulas is in. Here is the macro I am trying to use...
I even named the table in the Name Manager.
Thank you,
Jared Z.
[TABLE="width: 96"]
<colgroup><col width="64" style="width: 48pt;" span="2"> <tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Find[/TD]
[TD="width: 64, bgcolor: transparent"]Replace[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$M
[/TD]
[TD="bgcolor: transparent"]$Q[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$N[/TD]
[TD="bgcolor: transparent"]$R[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$O[/TD]
[TD="bgcolor: transparent"]$S[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$P[/TD]
[TD="bgcolor: transparent"]$T[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$Q[/TD]
[TD="bgcolor: transparent"]$U[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$R[/TD]
[TD="bgcolor: transparent"]$V[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$S[/TD]
[TD="bgcolor: transparent"]$W[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$T[/TD]
[TD="bgcolor: transparent"]$X[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]$U[/TD]
[TD="bgcolor: transparent"]$Y[/TD]
[/TR]
</tbody>[/TABLE]
I checked in the other worksheet and nothing was changed there and nothing was done in the worksheet that this table and the columns with the formulas is in. Here is the macro I am trying to use...
Code:
Sub Find_and_Replace()
Worksheets("Run Macros").Activate
Dim ws As Worksheet
Dim rngFind As Range
Dim strFind As String
Dim strReplace As String
Set ws = Worksheets("Run Macros")
strFind = "$M"
Set rngFind = ws.Range("F2:N11").Find(strFind, LookAt:=xlWhole)
If Not rngFind Is Nothing Then
strReplace = rngFind.Offset(0, 1).Value
End If
'strReplace should now equal $M
'(Based on your lookup table)
End Sub
I even named the table in the Name Manager.
Thank you,
Jared Z.