Macro to create a Shapre

eoinymc

Board Regular
Joined
Jan 29, 2009
Messages
203
Hi,

I was previously working in Excel 2000 and have upgraded to Excel 2007 only a couple of months ago.

Background to problem:
I have a workbook with 3 different sheets. I only want 1 of the sheets to be "Activated" at a particular time. So, for the sheet that I want to de-activate, I create a rectangle and place it over the sheet. This way the user cannot use any of the fields in the de-activated sheets.

I am updating the entire file and have copied the sub from the old file to the new one. This is the code I am copying..

Sheets("Price").Select
ActiveSheet.Shapes("Rectangle 16").Select
Selection.ShapeRange.Height = 561.75
Selection.ShapeRange.Width = 801


It works fine in the old file, but when I run it in the new file, I get an error:

The item with the specified name wasn't found.

It is the ActiveSheet.Shapes("Rectangle 16").Select line that is causing the problem.

I inherited this macro, so if anyone can point me in the right direction to get this working, I would be very grateful.

If you require any other information, please let me know.

Regards,

Eoin
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If you don't want the user to get to the sheet then set it to very hidden when the workbook opens and if you want to do something on it then use a password to get to it.

Private Sub Workbook_Open()
Worksheets("Sheet2").Visible = xlVeryHidden
End Sub
 
Upvote 0
Thanks, but I want the user to be able to actually go to the sheet and click "Activate"...thus the macro will cover the other sheets that aren't being used...

Do you get me?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top