Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a Summary worksheet that updates daily using several vlookup formulas.
I created a macro that would archive this information. In the macro, I first make a copy of the summary worksheet. Then on the copy, I copy/paste special the values and formats onto the worksheet to make sure that I get only the values and not the vlookup formulas. The problem is that when I go to run the macro the next day, it creates a copy of the wrong worksheet. I need it to create a copy of the Summary worksheet. Here is the code for the macro. Sub Archive() ' ' Archive Macro ' Macro recorded 6/12/2007 by Nekiah V. Jackson ' ' Keyboard Shortcut: Ctrl+b ' Sheets("Summary").Select Sheets("Summary").Copy Befo=Sheets(5) Sheets("Summary (2)").Select Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("D11").Select End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Your code looks like it always copies the worksheet named Summary.
Maybe you meant that it it always copy|pastespecial values against the wrong sheet. Option Explicit Sub Archive2() with activeworkbook 'put it at the end? .Sheets("Summary").Copy _ After:=.Sheets(.sheets.count) end with with activesheet 'the sheet just created .cells.copy .cells.pastespecialPaste:=xlPasteValues end with End Sub This doesn't rely on the name of the new sheet--it just uses the newly activated sheet (the one that was just created by the .copy). clarknv wrote: I have a Summary worksheet that updates daily using several vlookup formulas. I created a macro that would archive this information. In the macro, I first make a copy of the summary worksheet. Then on the copy, I copy/paste special the values and formats onto the worksheet to make sure that I get only the values and not the vlookup formulas. The problem is that when I go to run the macro the next day, it creates a copy of the wrong worksheet. I need it to create a copy of the Summary worksheet. Here is the code for the macro. Sub Archive() ' ' Archive Macro ' Macro recorded 6/12/2007 by Nekiah V. Jackson ' ' Keyboard Shortcut: Ctrl+b ' Sheets("Summary").Select Sheets("Summary").Copy Befo=Sheets(5) Sheets("Summary (2)").Select Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("D11").Select End Sub -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Oops. Dropped a space character:
..cells.pastespecialPaste:=xlPasteValues should be: ..cells.pastespecial Paste:=xlPasteValues Dave Peterson wrote: Your code looks like it always copies the worksheet named Summary. Maybe you meant that it it always copy|pastespecial values against the wrong sheet. Option Explicit Sub Archive2() with activeworkbook 'put it at the end? .Sheets("Summary").Copy _ After:=.Sheets(.sheets.count) end with with activesheet 'the sheet just created .cells.copy .cells.pastespecialPaste:=xlPasteValues end with End Sub This doesn't rely on the name of the new sheet--it just uses the newly activated sheet (the one that was just created by the .copy). clarknv wrote: I have a Summary worksheet that updates daily using several vlookup formulas. I created a macro that would archive this information. In the macro, I first make a copy of the summary worksheet. Then on the copy, I copy/paste special the values and formats onto the worksheet to make sure that I get only the values and not the vlookup formulas. The problem is that when I go to run the macro the next day, it creates a copy of the wrong worksheet. I need it to create a copy of the Summary worksheet. Here is the code for the macro. Sub Archive() ' ' Archive Macro ' Macro recorded 6/12/2007 by Nekiah V. Jackson ' ' Keyboard Shortcut: Ctrl+b ' Sheets("Summary").Select Sheets("Summary").Copy Befo=Sheets(5) Sheets("Summary (2)").Select Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("D11").Select End Sub -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to copy worksheet | Excel Worksheet Functions | |||
create a macro to copy a worksheet into another | Excel Discussion (Misc queries) | |||
Macro copy and paste = blank worksheet | Excel Discussion (Misc queries) | |||
Want macro to select & copy cells from a different worksheet | Excel Discussion (Misc queries) | |||
I need help with a macro which will copy a worksheet and.. | Excel Worksheet Functions |