Results 1 to 7 of 7

Run macro in different cell than recorded

Threaded View

  1. #1
    Registered User
    Join Date
    04-15-2018
    Location
    MI
    MS-Off Ver
    2016
    Posts
    7

    Run macro in different cell than recorded

    Hello All,

    I have a worksheet that has multiple options for us to highlight. I have recorded a macro to change the fill to black, bold the font and change it white. How Do i now change this code to work on any of the cells (all merged) I please.

    Sub Black_Fill()
    '
    ' Black_Fill Macro
    '
    
    '
        Range("A10:G10").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
        With Selection.Font
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
        End With
        Selection.Font.Bold = True
        With Selection
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = True
        End With
        With Selection.Font
            .Name = "Calibri"
            .FontStyle = "Bold"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
    End Sub
    I will end up making a macro to revert back to original format once the option i need highlighted on my worksheet is no longer needed.

    I would like to in the end add a cmd button to my context menu in the end.

    Appreciate the assistance from you all!

    -A
    Last edited by Moomoo327; 04-15-2018 at 09:38 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Recorded Pivot Table Macro Doesn't Do What I Recorded!
    By diakonos1984 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2013, 11:01 AM
  2. [SOLVED] How to run a recorded macro when cell values change?
    By Clue_Less in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-15-2012, 12:01 PM
  3. Run pre recorded macro from any selected cell
    By Si902 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-26-2011, 03:43 PM
  4. Cursor Needs in Same Cell in Recorded Macro
    By tariqnaz2005 in forum Excel General
    Replies: 7
    Last Post: 02-09-2010, 06:28 AM
  5. Macro that splits any cell not just the one recorded with the same numbers
    By emj08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2008, 06:11 AM
  6. Recorded macro has hard cell contents.
    By DocBrown in forum Excel General
    Replies: 4
    Last Post: 08-11-2006, 02:20 PM
  7. Excel macro, editing recorded cell.. not current
    By TroyT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2006, 09:30 AM

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