Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macros - copying macros from one computer to another | Excel Discussion (Misc queries) | |||
copying macros | Excel Worksheet Functions | |||
copying macros | Excel Worksheet Functions | |||
Copying and PAsting using MACROS | Excel Worksheet Functions | |||
Copying a spreadsheet with macros | Excel Worksheet Functions |