copy to the same workbook

  • Thread starter Alexander Bogomolny
  • Start date
A

Alexander Bogomolny

Hello:

When "Copy or Move" sheet, in the dialog there is an opportunity to
define a workbook to copy the sheet to. However if I created a macro, it
does not reflect my choice, i.e., it comes the same whether I define or
not define a workbook.

Furthermore, when I run the created macro

Sheets("sheet").copy

the first time, it places a copy of sheet "sheet" as "sheet (2)" in the
same book. However, when run the second time it creates a new workbook
without my meaning to.

My question: is there a way to specify in the macor the workbook a sheet
is to be copied to.

Thank you,
Alex
 
A

Alexander Bogomolny

Mark, thank you.

You see, I do that from inside Java. For me it looks like

Sheets sheets = Workbook.getSheets();
Sheet sheet = sheets.getItem("sheet");
sheet.copy(sheet);

where the argument sheet in the copy method means "Before", which I
presume as suitable as "After" to my ends. So inside the parentheses a
sheet is a sheet (that came from a certain workbook.) There is no way
for me to specify sheets as an additional argument.

I would expect that something like

sheet.activate();

would work, but it does not.

In fact, I never want a second book, but only the one I start with.
Should not there be a default somewhere?

Thank you,
Alex
 
Top