Macro to create table from selection copy

Macro to create table from selection

Sub TableCreate()

'

' TableCreate Macro

'

'https://msdn.microsoft.com/en-us/library/office/ff823155.aspx

' ctrl+l

Dim objTable As ListObject

Set objTable = ActiveSheet.ListObjects.Add(xlSrcRange, Selection, , xlYes)

objTable.TableStyle = "TableStyleMedium2"

    With Selection

        .HorizontalAlignment = xlGeneral

        .VerticalAlignment = xlTop

        .WrapText = False

        .Orientation = 0

        .AddIndent = False

        .IndentLevel = 0

        .ShrinkToFit = False

        .ReadingOrder = xlContext

        .MergeCells = False

    End With

End Sub

Tags:

No comments yet.

Leave a Reply