Results 1 to 11 of 11

Macro only runs on sheet i recorded it on.

Threaded View

  1. #1
    Registered User
    Join Date
    09-19-2011
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    6

    Macro only runs on sheet i recorded it on.

    I have a macro that i recorded on the first tab of my spreadsheet. I need it to function on all the tabs, and it looks likeits hanging up because it specficially only works on the first tabe. Here is the code form the macro. Can you guys pleasehelp me figure out how to make it function on all the tabs of the workbook.

    Thanks,
    brian


    Sub pastImacro()
    '
    ' pastImacro Macro
    '
    ' Keyboard Shortcut: Ctrl+i
    '
        Range("A3").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Range("Table2").Select
        Range("F3").Activate
        Application.CutCopyMode = False
        ActiveWorkbook.Worksheets("01-Sep-2010").ListObjects("Table2").Sort.SortFields. _
            Clear
        ActiveWorkbook.Worksheets("01-Sep-2010").ListObjects("Table2").Sort.SortFields. _
            Add Key:=Range("Table2[Status]"), SortOn:=xlSortOnValues, Order:= _
            xlAscending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("01-Sep-2010").ListObjects("Table2").Sort.SortFields. _
            Add Key:=Range("Table2[Created On]"), SortOn:=xlSortOnValues, Order:= _
            xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("01-Sep-2010").ListObjects("Table2").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        Range("F3").Select
        ActiveWindow.SmallScroll Down:=-27
        Range("A3:F3").Select
        Range("F3").Activate
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = -0.249977111117893
            .PatternTintAndShade = 0
        End With
        Range("A4:F4").Select
        Range("F4").Activate
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = -0.349986266670736
            .PatternTintAndShade = 0
        End With
        Range("A3:F4").Select
        Selection.Copy
        ActiveWindow.ScrollColumn = 4
        ActiveWindow.ScrollColumn = 3
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 1
        Range("A5:F101").Select
        Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
    End Sub
    Last edited by BF15; 09-19-2011 at 06:44 PM.

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