Results 1 to 7 of 7

Code working but on wrong sheet

Threaded View

pauldaddyadams Code working but on wrong... 11-11-2011, 05:03 AM
royUK Re: Code working but on wrong... 11-11-2011, 05:37 AM
pauldaddyadams Re: Code working but on wrong... 11-11-2011, 06:08 AM
Alf Re: Code working but on wrong... 11-11-2011, 07:13 AM
pauldaddyadams Re: Code working but on wrong... 11-11-2011, 07:17 AM
Colin Legg Re: Code working but on wrong... 11-11-2011, 07:25 AM
pauldaddyadams Re: Code working but on wrong... 11-11-2011, 07:29 AM
  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Code working but on wrong sheet

    Hi,

    The code below works however it copies it to the wrong sheet (the sheet you are viewing when the macro is ran).

    I think this is the part i need to amend:
    CopyToRange:=Range("A1"), Unique:=True
    Is there any way I can select the sheet I want to copy it to e.g.
    =Range(Sheets("macro"."A1")

    This is the code in full

    Sub Macro1()
    
    ' Macro1 Macro
    
        Sheets("May Sales.xls").Columns("D:D").AdvancedFilter Action:=xlFilterCopy, _
            CopyToRange:=Range("A1"), Unique:=True
        Sheets("macro").Range("A2:A" & Sheets("Macro").Cells(Rows.Count, "A").End(xlUp).Row).Copy
        ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
        Sheets("Overview").Range("I4").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
    End Sub
    Last edited by pauldaddyadams; 11-11-2011 at 07:30 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1