I know there are several threads but I wasn't able to find something which will fit my needs.
I have a sheet in which I want to Find & Replace cell values based on the cell $B1 which will be a drop down list. Also I need to mention that the cells which I want to replace the string have formulas. Here's an example of what a cell looks:
=IF('http://sharepoint.www.com/Industrial Engineering/2011.06 June/[Workbook.xls]June'!I218=0,"",'http://sharepoint.www.com/Industrial Engineering/2011.06 June/[Workbook.xls]June'!I218)
By changing the value from $B1 from Workbook to Workbook1 I want to automatically replace in a specific range the values from the cell: Workbook.xls with Workbook1.xls
I have a code which will work but I need to narrow down the replace function to a specific range like $A2:$BA250
My macro looks like this:
![]()
Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim txtW As String txtW = Range("$H$13").Value Dim txtR As String txtR = Range("$B$1").Value If Target.Address = "$B$1" Then Cells.Replace What:=txtW, Replacement:=txtR, LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Else Range("$b$1").Select End If End Sub
Bookmarks