Close

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

    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
    1396

    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 www.mrexcel.com 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. . . .


Similar Threads

  1. excel for fee
    By bobbobb in forum Programming
    Replies: 8
    Last Post: 7th March 2005, 11:22 PM
  2. Replies: 3
    Last Post: 16th November 2002, 12:42 AM
  3. help with cdrwin & cue sheet
    By toddster in forum Sony Consoles
    Replies: 3
    Last Post: 22nd October 2002, 12:52 PM
  4. old but active
    By shadygeezer in forum The Comedy Club
    Replies: 1
    Last Post: 14th October 2002, 09:08 PM
  5. Excel graph problem
    By marktb in forum PC Problems
    Replies: 2
    Last Post: 9th October 2002, 04:42 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
  •