ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Use of macros on spreadhseet copies (https://www.excelbanter.com/excel-discussion-misc-queries/201134-use-macros-spreadhseet-copies.html)

Wayne

Use of macros on spreadhseet copies
 
I have a spreadsheet with quite a few macros defined. All the macros work
with the original sheet. However, when I create a copy of the sheet in the
same workbook, this macro statement crashes:


"ActiveSheet.Shapes(Cell(i,32).Value).IncrementLef t 660"

The value of the index (Cell(i,32).Value) is a string and is defined;
ActiveSheet.Shapes with that index cannot be found in the copied sheet.

Help!

--
VB Amateur

joel

Use of macros on spreadhseet copies
 
hape names will change when you copy a sheet if you use the default shapes name

I put 3 rectangles on a sheet and the default names were
Rectangle 1
Rectangle 2
Rectangle 3

I then deleted rectangle 2. Next I copied the sheet to a new sheet. The
new sheet had

Rectangle 1
Rectangle 2

Excel rename Rectangle 3 to rectangle to on the new sheet.

I then repeated the experiment by rename the rectangles MyRect1 and MyRect3.
when the sheet was copied the names of the rectangles again were changed

MyRect1
MyRect2

Finally I put a number at the middle instead of the end and the names didn't
change.

My1Rect
My3Rect



"Wayne" wrote:

I have a spreadsheet with quite a few macros defined. All the macros work
with the original sheet. However, when I create a copy of the sheet in the
same workbook, this macro statement crashes:


"ActiveSheet.Shapes(Cell(i,32).Value).IncrementLef t 660"

The value of the index (Cell(i,32).Value) is a string and is defined;
ActiveSheet.Shapes with that index cannot be found in the copied sheet.

Help!

--
VB Amateur



All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com