LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 1
Default Applying macro to mulitple worksheets?

Hello -

How do I apply the following macro to multiple worksheets at the same time?



Sub ErrorTrapAddDDL()

' Adds =If(IsError() around formulas

Dim cel As Range
Dim rng As Range
Dim Check As String

Const Equ As String = "=IF(ISERROR(_x) ,"""", _x)"

Check = Left$(Equ, 12) & "*" ' Check for =IF(ISERROR(

On Error Resume Next

Set rng = Selection.SpecialCells(xlFormulas, 23)
If rng Is Nothing Then Exit Sub

With WorksheetFunction
For Each cel In rng
If Not cel.Formula Like Check Then
cel.Formula = .Substitute(Equ, "_x", Mid$(cel.Formula, 2))
End If
Next
End With
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
Applying a macro to all worksheets DannyS Excel Discussion (Misc queries) 7 January 15th 07 05:21 PM
applying modules to mulitple worksheet violet Excel Programming 18 September 11th 06 04:20 AM
mulitple worksheets vlookup Max_power Excel Discussion (Misc queries) 7 March 21st 06 04:06 PM
Applying same macro to all worksheets in workbook [email protected] Excel Discussion (Misc queries) 2 October 19th 05 11:25 PM
Changes to Mulitple Worksheets Mac Landers Excel Worksheet Functions 3 January 26th 05 12:59 AM


All times are GMT +1. The time now is 06:32 AM.

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

About Us

"It's about Microsoft Excel"