Close

Results 1 to 3 of 3
  1. #1
    DF Jedi Karoline's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,551
    Thanks
    106
    Thanked:        59
    Karma Level
    403

    Default Excel Macro Help - Run macro using active sheet

    I'm trying to run a macro but it doesn't seem to want to play...

    What I want it to do..

    I have a hidden sheet called Test, I want to copy some data from the active worksheet (eg Jan), unhide the sheet Test, paste the info into the worksheet Test, remove any cells that are blank, set column into ascending order, change the font size, then print the info, remove all the info I have just pasted, then hide the worksheet Test again.

    I want this to run, so no matter which worksheet im on, (ie, Jan, Feb, Mar etc) it will copy the Range("B21:B46,N21:N46") and paste it into the worksheet Test

    Where am I going wrong? Can anyone help ?


    Code:
     
    
    Sub Macro4()
    
    Range("B21:B46,N21:N46").Select
        Range("N21").Activate
        Selection.Copy
        Sheets("Test").Visible = True
        Range("A4").Select
        ActiveSheet.Paste
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Application.CutCopyMode = False
        Selection.EntireRow.Delete
        Range("A4").Select
        Range("A4:B19").Sort Key1:=Range("A4"), Order1:=xlAscending, Header:= _
            xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal
        Cells.Select
        With Selection.Font
            .Name = "Arial"
            .Size = 8
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
        Selection.Delete Shift:=xlUp
        ActiveWindow.SelectedSheets.Visible = False
    End Sub

  2. #2
    DF Rookie dpbarry's Avatar
    Join Date
    Dec 2014
    Location
    UK
    Posts
    4
    Thanks
    0
    Thanked:        1
    Karma Level
    0

    Default Re: Excel Macro Help - Run macro using active sheet

    I know thread is old and not wishing to bump you away from a great site but if you were to post this query in the Excel forum of ************* you will probably get a good response. It has worked for me on many occasions

    Declan
    Last edited by blaggard; 11th December 2014 at 04:36 PM.

  3. #3
    DF VIP Member
    blaggard's Avatar
    Join Date
    Jan 2001
    Location
    South London
    Posts
    15,748
    Thanks
    1,517
    Thanked:        1,902
    Karma Level
    1506

    Default Re: Excel Macro Help - Run macro using active sheet

    Quote Originally Posted by dpbarry View Post
    I know thread is old and not wishing to bump you away from a great site but if you were to post this query in the Excel forum of [Only registered and activated users can see links. ] you will probably get a good response. It has worked for me on many occasions

    Declan
    You have failed to read your welcome message (or at least understand it) because you look like you might fit right in here I'm cutting you some slack, please don't turn into a spammer or leech, I've removed the link from your first post.
    If at first you don't succeed.....redefine success. . . .

    [Only registered and activated users can see links. ]

Similar Threads

  1. [HELP] Desperate kids excel coursework need help with macro
    By Teajunkie in forum Programming
    Replies: 8
    Last Post: 22nd October 2014, 12:25 PM
  2. Silly Macro... or perhaps not so Macro?
    By dpSparhawk in forum Your Photos & Artwork
    Replies: 2
    Last Post: 4th August 2013, 11:29 PM
  3. Excel Macro basics
    By Gazzr in forum Programming
    Replies: 11
    Last Post: 3rd November 2011, 10:06 PM
  4. Excel Macro Prob
    By Hadfield82 in forum Programming
    Replies: 2
    Last Post: 27th January 2007, 08:33 PM
  5. [EXCEL] Login Sheet
    By Keva in forum PC Software
    Replies: 0
    Last Post: 2nd February 2005, 05:06 PM

Social Networking 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
  •