Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default copying macros to other sheets

hi
sorry it took so long to get back. i got hung up.
looks like you did this on record so i cleaned up up a bit by commenting out
the unnecessary stuff and consolidating. you should see what i commented out.
should be faster. no flopping back and forth.
sheet1 seems to be the summary sheet so everything is geared to paste there.
select what ever sheet you want then run the macro. so long as you so that,
this macro will work with any sheet.
As to the button on each sheet. put the code below in a standard module. for
the button code do this....
Private Sub CommandButton1_Click()
Call Print_Sheet
End Sub
then copy the button to each sheet. you may have to add the "call
print_sheet".

TEST this on a dummy copy of your file BEFORE you try it on LIVE data.

sub Print_Sheets()
'Sheets("Sheet1").Select
Sheets("sheet1").Range("A1:A2").ClearContents
Sheets("sheet1").Range("G1:G2").ClearContents
Sheets("sheet1").Range("A4:G16").ClearContents
'Sheets("8P-2 Stivers").Select
Range("A1:A2").Copy Destination:= _
Sheets("sheet1").Range("A1")
'Range("A1:A2").Copy
'Sheets("Sheet1").Select
'Range("A1").Select
'ActiveSheet.Paste
'Sheets("8P-2 Stivers").Select
Range("A4:A16").Copy Destination:= _
Sheets("Sheet1").Range("A4")
'Range("A4:A16").Select
'Application.CutCopyMode = False
'Selection.Copy
'Sheets("Sheet1").Select
'Range("A4").Select
'ActiveSheet.Paste
'Sheets("8P-2 Stivers").Select
Range("F4:F16").Copy Destination:= _
Sheets("Sheet1").Range("B4")
'Range("F4:F16").Select
'Application.CutCopyMode = False
'Selection.Copy
'Sheets("Sheet1").Select
'Range("B4").Select
'ActiveSheet.Paste
'Sheets("8P-2 Stivers").Select
Range("G4:G16").Copy Destination:= _
Sheets("Sheet1").Range("C4:C16")
'Range("G4:G16").Select
'Application.CutCopyMode = False
'Selection.Copy
'Sheets("Sheet1").Select
'Range("C4:C16").Select
'ActiveSheet.Paste
'Sheets("8P-2 Stivers").Select
'ActiveWindow.SmallScroll ToRight:=8
Range("L4:M16").Copy Destination:= _
Sheets("sheet1").Range("D4")
'Range("L4:M16").Select
'Application.CutCopyMode = False
'Selection.Copy
'Sheets("Sheet1").Select
'Range("D4").Select
'ActiveSheet.Paste
'Sheets("8P-2 Stivers").Select
'ActiveWindow.LargeScroll ToRight:=2
'ActiveWindow.SmallScroll ToRight:=-10
Range("U4:V16").Copy Destination:= _
Sheets("Sheet1").Range("F4")
'Range("U4:V16").Select
'Application.CutCopyMode = False
'Selection.Copy
'Sheets("Sheet1").Select
'Range("F4").Select
'ActiveSheet.Paste
'Sheets("8P-2 Stivers").Select
Range("T17").Copy
Sheets("Sheet1").Select
'Range("T17").Select
'Application.CutCopyMode = False
'Selection.Copy
'Sheets("Sheet1").Select
Range("G1").PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False

End Sub

regards
FSt1

"esilverb" wrote:

Here's the code
Sub Print_Sheet()
'
' Print_Sheet Macro
'

'
Sheets("Sheet1").Select
Range("A1:A2").Select
Selection.ClearContents
Range("G1:G2").Select
Selection.ClearContents
Range("A4:G16").Select
Selection.ClearContents
Sheets("8P-2 Stivers").Select
Range("A1:A2").Select
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("8P-2 Stivers").Select
Range("A4:A16").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("A4").Select
ActiveSheet.Paste
Sheets("8P-2 Stivers").Select
Range("F4:F16").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("B4").Select
ActiveSheet.Paste
Sheets("8P-2 Stivers").Select
Range("G4:G16").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("C4:C16").Select
ActiveSheet.Paste
Sheets("8P-2 Stivers").Select
ActiveWindow.SmallScroll ToRight:=8
Range("L4:M16").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D4").Select
ActiveSheet.Paste
Sheets("8P-2 Stivers").Select
ActiveWindow.LargeScroll ToRight:=2
ActiveWindow.SmallScroll ToRight:=-10
Range("U4:V16").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("F4").Select
ActiveSheet.Paste
Sheets("8P-2 Stivers").Select
Range("T17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("G1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

"FSt1" wrote:

hi
it might be helpful if you posted your current code.

regard
FSt1

"esilverb" wrote:

I have a button that runs a macro taking data from the active sheet and
putting it in a separate summary sheet and then printing the summary sheet. I
want to put a button on every sheet in the workbook that will do the exact
same thing - take the data from that sheet, put it on the summary sheet and
then print the summary sheet. How do I copy the button and the macro so that
it will work on each sheet?
Note: the macro begins by clearning out the summary sheet so the new data
gets put into a clean worksheet.
Thanks for your help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros - copying macros from one computer to another TT Excel Discussion (Misc queries) 18 December 14th 06 03:24 AM
copying macros Louise Excel Worksheet Functions 4 May 26th 06 04:26 PM
copying macros Louise Excel Worksheet Functions 2 May 18th 06 04:51 PM
Copying and PAsting using MACROS [email protected] Excel Worksheet Functions 9 March 29th 05 07:34 PM
Copying a spreadsheet with macros WayneB Excel Worksheet Functions 4 March 12th 05 11:19 PM


All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"