![]() |
Macro to Perform Same Function Across Selected Sheets
Hi all,
I'm new to VBA and could use some help. I'm trying to have a macro perform the same function (paste a rectangle) across several selected sheets (say, 1-4,7,9,10 of 10). I can get the macro to paste the rectangle across ALL the sheets, but I only want it on those selected. Any ideas? Thanks in advance, Stephan |
Macro to Perform Same Function Across Selected Sheets
As always, post your coding efforts for comments and suggestions.
-- Don Guillett SalesAid Software wrote in message ups.com... Hi all, I'm new to VBA and could use some help. I'm trying to have a macro perform the same function (paste a rectangle) across several selected sheets (say, 1-4,7,9,10 of 10). I can get the macro to paste the rectangle across ALL the sheets, but I only want it on those selected. Any ideas? Thanks in advance, Stephan |
Macro to Perform Same Function Across Selected Sheets
Here's the code I currently have:
Sub CoverStopwatch() ' ' CoverStopwatch Macro ' Dim sh As Worksheet For Each sh In ActiveWorkbook.Worksheets sh.Select ActiveSheet.Shapes.AddShape(msoShapeRectangle, 3.75, 39.75, 79.5, 37.5). _ Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 19 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRange.Shadow.Visible = msoFalse ActiveSheet.Shapes.AddShape(msoShapeRectangle, 4.5, 540#, 82.5, 21.75). _ Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 19 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRange.Shadow.Visible = msoFalse Range("Q1:V1").Select Next sh End Sub Thanks. Don Guillett wrote: As always, post your coding efforts for comments and suggestions. -- Don Guillett SalesAid Software wrote in message ups.com... Hi all, I'm new to VBA and could use some help. I'm trying to have a macro perform the same function (paste a rectangle) across several selected sheets (say, 1-4,7,9,10 of 10). I can get the macro to paste the rectangle across ALL the sheets, but I only want it on those selected. Any ideas? Thanks in advance, Stephan |
Macro to Perform Same Function Across Selected Sheets
thanks!
Don Guillett wrote: Sub ss() For Each ws In ActiveWindow.SelectedSheets MsgBox ws.Name Next ws End Sub -- Don Guillett SalesAid Software wrote in message ups.com... Here's the code I currently have: Sub CoverStopwatch() ' ' CoverStopwatch Macro ' Dim sh As Worksheet For Each sh In ActiveWorkbook.Worksheets sh.Select ActiveSheet.Shapes.AddShape(msoShapeRectangle, 3.75, 39.75, 79.5, 37.5). _ Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 19 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRange.Shadow.Visible = msoFalse ActiveSheet.Shapes.AddShape(msoShapeRectangle, 4.5, 540#, 82.5, 21.75). _ Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 19 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRange.Shadow.Visible = msoFalse Range("Q1:V1").Select Next sh End Sub Thanks. Don Guillett wrote: As always, post your coding efforts for comments and suggestions. -- Don Guillett SalesAid Software wrote in message ups.com... Hi all, I'm new to VBA and could use some help. I'm trying to have a macro perform the same function (paste a rectangle) across several selected sheets (say, 1-4,7,9,10 of 10). I can get the macro to paste the rectangle across ALL the sheets, but I only want it on those selected. Any ideas? Thanks in advance, Stephan |
Macro to Perform Same Function Across Selected Sheets
Glad to help
-- Don Guillett SalesAid Software wrote in message oups.com... thanks! Don Guillett wrote: Sub ss() For Each ws In ActiveWindow.SelectedSheets MsgBox ws.Name Next ws End Sub -- Don Guillett SalesAid Software wrote in message ups.com... Here's the code I currently have: Sub CoverStopwatch() ' ' CoverStopwatch Macro ' Dim sh As Worksheet For Each sh In ActiveWorkbook.Worksheets sh.Select ActiveSheet.Shapes.AddShape(msoShapeRectangle, 3.75, 39.75, 79.5, 37.5). _ Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 19 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRange.Shadow.Visible = msoFalse ActiveSheet.Shapes.AddShape(msoShapeRectangle, 4.5, 540#, 82.5, 21.75). _ Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 19 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRange.Shadow.Visible = msoFalse Range("Q1:V1").Select Next sh End Sub Thanks. Don Guillett wrote: As always, post your coding efforts for comments and suggestions. -- Don Guillett SalesAid Software wrote in message ups.com... Hi all, I'm new to VBA and could use some help. I'm trying to have a macro perform the same function (paste a rectangle) across several selected sheets (say, 1-4,7,9,10 of 10). I can get the macro to paste the rectangle across ALL the sheets, but I only want it on those selected. Any ideas? Thanks in advance, Stephan |
All times are GMT +1. The time now is 02:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com