Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Ruben Jackson   on Feb 06 In MS Office Category.

  
Question Answered By: Balbir Kaur    on Feb 06

The solution is good. But calling the rectangle_make program for each sheet
will be cumbersome.
I have provided a simplified version below:

Sub Rectangle_Sheets()

' This procedure calls the rectangle_make macro  with teh sheet  Number as the
argument

' Define an array with the sheet numbers that you want the rectangle in
RecSh = Array(1, 2, 3, 4, 7, 9, 10)
' Loop thru the array and call the "rectangle_make" macro for each sheet
' You don't need to select the sheet
For i = 1 To UBound(RecSh)
Call rectangle_make(RecSh(i))
Next i

End Sub

' This macro is called by the main program
Sub rectangle_make(ShNo)

Set myDocument = Worksheets(ShNo)
' Add a rectangle at 150, 50 of size 300x200
myDocument.Shapes.AddShape msoShapeRectangle, 150, 50, 300, 200

End Sub

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Macro to Perform Same Function Only on Certain Sheets Or get search suggestion and latest updates.


Tagged: