Is it possible to change every cell within a sheet whose formula contains a certain word to a value? In my case the formula is referencing another sheet.
I was thinking of using activesheet.cells. After giving it consideration, the code would be looking at every cell and would not be very efficient.
CurrentRegion would not work because not all cells are contiguous.
Regards,
John
VBA Code Assistance: Formula to Value
-
- GoldLounger
- Posts: 2628
- Joined: 26 Jan 2010, 16:31
- Location: Southern California
VBA Code Assistance: Formula to Value
Regards,
John
John
-
- 2StarLounger
- Posts: 112
- Joined: 25 Jan 2010, 20:19
Re: VBA Code Assistance: Formula to Value
You can use 'special cells' to limit your search to only cells containing formulas.
Code: Select all
Sub ChangeToValues()
Dim rForms As Range, rChange As Range
Set rForms = Cells.SpecialCells(xlCellTypeFormulas, 23)
For Each rChange In rForms
If InStr(1, rChange.Formula, "Sheet2") Then
rChange.Value = rChange.Value
End If
Next
End Sub
-
- GoldLounger
- Posts: 2628
- Joined: 26 Jan 2010, 16:31
- Location: Southern California
Re: VBA Code Assistance: Formula to Value
mbarron,
It works wonderfully.
Thank you,
John
It works wonderfully.
Thank you,
John
Regards,
John
John