+ Reply to Thread
Results 1 to 8 of 8

Running a macro on combo box selection

Hybrid View

  1. #1
    Registered User
    Join Date
    11-06-2008
    Location
    Wales
    Posts
    10
    How do I allow a macro to change tabs, at the moment I could record the macro for a certain tab but it will only run on the one I triggered it from.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    If you post a macro that runs on a given sheet, I or someone else will show you how to change it to operate on a different sheet.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    11-06-2008
    Location
    Wales
    Posts
    10
    Here you go:

    Sub Macro5()
    '
    ' Macro5 Macro
    '
    
    '
        Range("E6").Select
        ActiveCell.FormulaR1C1 = _
            "=(R[5]C*'Database 3'!R[93]C[24])-R[5]C/3*'Database 3'!R[93]C[26]"
        Range("E7").Select
        ActiveCell.FormulaR1C1 = _
            "=(R[3]C*'Database 3'!R[92]C[24])-R[3]C/3*'Database 3'!R[92]C[26]"
        Range("E17:F18").Select
        ActiveCell.FormulaR1C1 = "24 Tanned Hides, Needle, Thread and 2 space fillers"
        With ActiveCell.Characters(Start:=1, Length:=51).Font
            .Name = "Calibri"
            .FontStyle = "Regular"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Range("C7:C8").Select
        ActiveCell.FormulaR1C1 = "Tanned D'hide's to bodys (Green)"
        With ActiveCell.Characters(Start:=1, Length:=32).Font
            .Name = "Calibri"
            .FontStyle = "Regular"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
        Range("C13").Select
        ActiveCell.FormulaR1C1 = "=General!R[33]C[2]"
        Range("C14").Select
        ActiveWindow.SmallScroll Down:=28
        Range("A32").Select
        ActiveCell.FormulaR1C1 = "62"
        Range("A33").Select
        ActiveWindow.SmallScroll Down:=-56
    End Sub

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Here you go:
    Sub Macro5()
        With Worksheets("someSheet") ' change as appropriate
            .Range("E6").FormulaR1C1 = "=(R[5]C*'Database 3'!R[93]C[24])-R[5]C/3*'Database 3'!R[93]C[26]"
            .Range("E7").FormulaR1C1 = "=(R[3]C*'Database 3'!R[92]C[24])-R[3]C/3*'Database 3'!R[92]C[26]"
            .Range("E17:F18").Value = "24 Tanned Hides, Needle, Thread and 2 space fillers"
            With .Range("E17").Font
                .Name = "Calibri"
                .FontStyle = "Regular"
                .Size = 11
                .ThemeColor = xlThemeColorDark1
                .TintAndShade = 0
                .ThemeFont = xlThemeFontMinor
            End With
            .Range("C7:C8").Value = "Tanned D'hide's to bodys (Green)"
            With .Range("C7").Font
                .Name = "Calibri"
                .FontStyle = "Regular"
                .Size = 11
                .ThemeColor = xlThemeColorDark1
                .TintAndShade = 0
                .ThemeFont = xlThemeFontMinor
            End With
            .Range("C13").FormulaR1C1 = "=General!R[33]C[2]"
            .Range("A32").Value = "62"
        End With
    End Sub

+ Reply to Thread

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