Consulting

Results 1 to 2 of 2

Thread: Format Current Selection as a Table

  1. #1

    Format Current Selection as a Table

    Hi,

    I'm trying to format the current selection as Table2.

    My code:

    Range("A1").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$CP$52"), , xlYes).Name = _
            "Table2"
    How do I get rid of that A1:CP52 range and just do current selection?

    Thanks.

  2. #2
    Got it!

    Dim rng As Range
    Dim loc As String
    loc = Selection.Address
    
    ActiveSheet.ListObjects.Add(xlSrcRange, Range(loc), , xlYes).Name = _
    "Table2"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •