Excel Macro Help - Run macro using active sheet

Thread: Excel Macro Help - Run macro using active sheet

  1. Karoline's Avatar

    Karoline said:

    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: [View]
     
    
    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. dpbarry's Avatar

    dpbarry said:

    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. blaggard's Avatar

    blaggard said:

    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. ]