Macros in Excel Spread sheets?
I want to write a macro where I can insert a line below the current line, format the cells to merge, bring the text to the top, and wrap the text. I know how to write the macro, however, how do I get the macro to work on any line in the workbook, not just the line I created it on?
Keyboard Shortcut: Ctrl+m
'
Rows("4:4").Select
Selection.Insert Shift:=xlDown
Range("B:D").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.mergecells = False
How should I change it to make it work? What exactly do I need to type in?
I don't want the rows to be restricted to "4:4", just wherever I hit the command.
I figured out how to get it to restrict to only the columns I want, but I can't figure out how to get it to stay in the row that the unmerged, unwrapped cell started in.