LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Need help on code - Macro on multiple worksheets

Sub SheetSub()

Dim cel As Range
Dim myStr As String

For Each sh In Sheets(Array("Sheet1", "Sheet2", "Sheet3"))

For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=ROUND(*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=ROUND(" & myStr & "," & "3" & ")"
End If
End If
Next
Next sh

End Sub

I am trying to have a macro that goes through all Sheets 1-3 and add
=Round() infront of a selection of cells. Right now, the code only performs
the function on the sheet I am currently on.
 
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
MACRO AND MULTIPLE WORKSHEETS Mel Excel Worksheet Functions 8 January 21st 07 02:53 PM
Macro Help (Uppercase multiple ranges?) Ken Excel Discussion (Misc queries) 14 December 2nd 06 07:23 PM
Macro referencing multiple worksheets JULZ Excel Discussion (Misc queries) 1 October 9th 06 07:46 PM
Can someone help me put psuedo code into actual excel macro?? bxc2739 Excel Discussion (Misc queries) 1 April 22nd 06 02:58 PM
CREATE MACRO TO COPY MULTIPLE WORKSHEETS Bewilderd jim Excel Discussion (Misc queries) 5 March 3rd 05 10:00 PM


All times are GMT +1. The time now is 05:51 AM.

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"