Code for Buttons (repost)
Call me stupid. No, really! As soon as I posted it
registered that I was using the activex button. Yes, I can
assign a macro. However, how would the code be different
if I was to use the activex button? I tried this but it
bombs on the range selection.
Windows("Source.xls").Activate
Sheets("Sheet1").Select
Range("C2:K2").Select
Selection.Copy
Windows("Master.xls").Activate
Sheets("Sheet1").Select
Range("D2:L2").Select
ActiveSheet.Paste
Mike
-----Original Message-----
Mike,
Are you sure you are using the button on the Forms
toolbar, as per Tom's
suggestion, and not the one on the Control Toolbox
toolbar?
--
HTH
Bob Phillips
"Mike" wrote in message
...
Brought this upfront since this forum tends to move
quickly. Had a followup question for Tom or anyone else.
.............
Thanks, Tom, however it's not working like that for me.
I
have Office XP and when I create a button it does not
ask
to assign macro nor does it have "assign macro" when
right
clicked. I have view code which opens a blank VBA space
for me to author a routine for the button (onclick).
Help also indicates to use View Code.
How should I approach this?
Mike
-----Original Message-----
put the button on the sheet (from the forms toolbar),
right click on it and
select assign macro. Actually, when you draw the
button
on the sheet, you
should get prompted with a dialog to assign a macro.
Once assigned, when you press the button, the button
fires the macro.
--
Regards,
Tom Ogilvy
Mike wrote in message
...
I have a simple copy and paste macro which pulls
from a
range in one workbook to another. How can I assign
that
macro to a command button (from forms)? It can't be a
menu
button becuase I will have too many. Does the button
call
the macro or do I need additional code (under view
code).
I tried to copy my macro code but didn't work.
Thanks.
.
.
|