View Single Post
  #1   Report Post  
abbruno abbruno is offline
Junior Member
 
Posts: 8
Default Macro adds "=" to each cell in defined range across multiple worksheets

I have the following macro that works great on a single worksheet. However, I need to get this to loop through a workbook. What is the most efficient way to do this?

Thanks for your help!


Option Explicit
Sub Set_Q2_Targets()

Dim myRng As Range
Dim myCell As Range

Set myRng = Nothing

On Error Resume Next
With Worksheets("Home Equity First Lien")
Set myRng = .Range("N14", .Cells(.Rows.Count, "N").End(xlUp)) _
.SpecialCells(xlCellTypeConstants)
End With
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "Macro Error"
Exit Sub
End If

For Each myCell In myRng.Cells
With myCell
.NumberFormat = "General"
.Formula = "=" & .Value
End With
Next myCell

End Sub