LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Worksheets("Sheetname").Select refuses to kick in from User Defined function Michiel via OfficeKB.com Excel Programming 14 February 21st 08 03:40 PM
Cell "A" Adds data to Other Cells joelbeveridge Excel Discussion (Misc queries) 8 August 3rd 06 04:42 AM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM


All times are GMT +1. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"