Excel Macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Junkie_ball
    Super Member
    Super Member
    • Jan 2004
    • 211

    Excel Macro

    Hi,

    I'm trying to record a simple marco in excel where i merge a number of cells into one, wrap text and then make the font bold. I have the macro working fine with one small problem. I would like the macro to work from the active cell not the cells i originally recorded the macro from.

    I have to do this task about 100 times a week and this will save numerious boring hours doing it. I have accessed the macros code and found the location in the code where it references the cells to format does anyone know the code to remove these references and make it the active cell to start the reference from? Hope that makes sense.

    Copy of code:

    ' Addreaa Macro
    ' Macro recorded 04/03/2010 by
    '
    ' Keyboard Shortcut: Ctrl+a
    '
    Rows("6:6").Select
    Selection.Insert Shift:=xlDown
    Range("B5:F6").Select
    With Selection
    .VerticalAlignment = xlBottom
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = True
    End With
    Range("B5:F6,A5").Select
    Range("A5").Activate
    Selection.Font.Bold = True
    End Sub
    SYSTEM:

    Pentioum Duo 6400, 8 GB Ram, 500Gb Hardrive, 32x DVD Rom, 16 x TCorp Duel Layer Burner, Geforce 7900GTX.


    Bow to the gods of Digital-Digest

    http://www.wix.com/martinhopkins/designandphotography
Working...