ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Attach Macro to single worksheet (https://www.excelbanter.com/excel-programming/387960-attach-macro-single-worksheet.html)

Paul H

Attach Macro to single worksheet
 
It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul

Dave Peterson

Attach Macro to single worksheet
 
Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul


--

Dave Peterson

Paul H

Attach Macro to single worksheet
 


"Dave Peterson" wrote:

Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul


--

Dave Peterson

The command button won't work in this case as the worksheet is to be
inserted into files that others will use.
I do copy the entire sheet but the macro referance remains to the original
file.

Paul

Dave Peterson

Attach Macro to single worksheet
 
If you use a commandbutton from the control toolbox toolbar, then the code for
that commandbutton is located behind the sheet.

And if you do copy the entire sheet (like edit|move or copy sheet), the both the
button and the code will go with that sheet.



Paul H wrote:

"Dave Peterson" wrote:

Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul


--

Dave Peterson

The command button won't work in this case as the worksheet is to be
inserted into files that others will use.
I do copy the entire sheet but the macro referance remains to the original
file.

Paul


--

Dave Peterson

Paul H

Attach Macro to single worksheet
 


"Dave Peterson" wrote:

If you use a commandbutton from the control toolbox toolbar, then the code for
that commandbutton is located behind the sheet.

And if you do copy the entire sheet (like edit|move or copy sheet), the both the
button and the code will go with that sheet.

I have two command buttons on the sheet itself and the control box insert button up top, the buttons do transfer to the new sheet but the macro do not. I have tried to use the Edit | move or copy to no avail.


What am I doing wrong?

Paul

Paul H wrote:

"Dave Peterson" wrote:

Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul

--

Dave Peterson

The command button won't work in this case as the worksheet is to be
inserted into files that others will use.
I do copy the entire sheet but the macro referance remains to the original
file.

Paul


--

Dave Peterson


Paul H

Attach Macro to single worksheet
 


"Dave Peterson" wrote:

If you use a commandbutton from the control toolbox toolbar, then the code for
that commandbutton is located behind the sheet.

And if you do copy the entire sheet (like edit|move or copy sheet), the both the
button and the code will go with that sheet.

The sheet I'm copying the new worksheet too already has a couple macro in, could this be the problem?

Paul H wrote:

"Dave Peterson" wrote:

Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul

--

Dave Peterson

The command button won't work in this case as the worksheet is to be
inserted into files that others will use.
I do copy the entire sheet but the macro referance remains to the original
file.

Paul


--

Dave Peterson


Dave Peterson

Attach Macro to single worksheet
 
I don't know.

Maybe you didn't use a commandbutton from the control toolbox toolbar?

Maybe you're not copying the worksheet via the Edit|Move or copy sheet dialog?



Paul H wrote:

"Dave Peterson" wrote:

If you use a commandbutton from the control toolbox toolbar, then the code for
that commandbutton is located behind the sheet.

And if you do copy the entire sheet (like edit|move or copy sheet), the both the
button and the code will go with that sheet.

I have two command buttons on the sheet itself and the control box insert button up top, the buttons do transfer to the new sheet but the macro do not. I have tried to use the Edit | move or copy to no avail.


What am I doing wrong?

Paul

Paul H wrote:

"Dave Peterson" wrote:

Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul

--

Dave Peterson

The command button won't work in this case as the worksheet is to be
inserted into files that others will use.
I do copy the entire sheet but the macro referance remains to the original
file.

Paul


--

Dave Peterson


--

Dave Peterson

Dave Peterson

Attach Macro to single worksheet
 
Are you copying the complete worksheet to a new workbook--or are you copying
some of the cells (all??) and then pasting into an existing worksheet in a
different workbook?



Paul H wrote:

"Dave Peterson" wrote:

If you use a commandbutton from the control toolbox toolbar, then the code for
that commandbutton is located behind the sheet.

And if you do copy the entire sheet (like edit|move or copy sheet), the both the
button and the code will go with that sheet.

The sheet I'm copying the new worksheet too already has a couple macro in, could this be the problem?

Paul H wrote:

"Dave Peterson" wrote:

Maybe you can use a control from the Control Toolbox toolbar (like a
commandbutton???).

When you copy the entire sheet (not the cells), the code behind the sheet will
travel with that sheet.

Paul H wrote:

It is possisle to attach a macro to a single worksheet so I can easily copy
the worksheet w/macro to another workbook?

Paul

--

Dave Peterson

The command button won't work in this case as the worksheet is to be
inserted into files that others will use.
I do copy the entire sheet but the macro referance remains to the original
file.

Paul


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 03:47 AM.

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