Export sheet with macro

  • Thread starter Thread starter BdgBill
  • Start date Start date
B

BdgBill

This is the last piece then ive got this thing done!

I have a large workbook with tons of data which is summarized on on
sheet. I want to be able to distrubute this workbook to my colleague
who can then export the summary sheet to send to clients.

I have a macro which exports the sheet perfectly into a new workbook.

Trouble is....I have a cool little macro on the sumary sheet which wil
highlight scores of different percentages when buttons are pressed.
cant get this macro into the new sheet. I tried setting up an existin
sheet with the macro in it, then telling the other macro to copy an
paste all the data to that sheet but i cant get that to work either.

Is it possible to embed the macro into the sheet so that it will trave
with the sheet when it is copied?


Thanks for your time
 
How are you populating that new worksheet/workbook?
And what kind of buttons are they?

If you're copying the whole sheet to the new workbook:
worksheets("summary").copy 'to a newworkbook

any code behind that worksheet will travel with the copy.

That means if you use buttons/controls from the control toolbox toolbar, that
code'll go, too.

If you're copying cells and pasting into a different worksheet or using buttons
from the forms toolbar, then I give some real thought to creating a template
workbook.

Build a nice worksheet with all the formatting (and buttons you want) already
there. Have the code in a general module of that template workbook.

Then use that template worksheet as your, er, template. Copy your cells into
that existing sheet and the buttons will be all set to go.

You could even protect the project to make the code a little more secure.
 
Back
Top