Trouble formatting my column headers

VRM

New Member
Joined
Jun 27, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi Folks,
I am still a novice. Working with Excel 2013.
The debugger states that I have problems with Range("Table27[[#Headers],[KHub Project Completeness]]").Select
Here is my code:
VBA Code:
    Range("D:E,G:G").Select
    Range("G1").Activate
    Selection.Delete Shift:=xlToLeft
    Range("A1").Select
    ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$J$382"), , xlYes).Name = _
        "Table27"
      ActiveSheet.ListObjects("Table27").TableStyle = "TableStyleLight21"
    Columns("A:J").Select
    Selection.Columns.AutoFit
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlTop
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    With Selection
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlTop
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Range("Table27[[#Headers],[KHub Project Completeness]]").Select
    ActiveCell.FormulaR1C1 = "KHub Project " & Chr(10) & "Completeness"
    Range("Table27[[#Headers],[Proposal Document ""Pass""]]").Select
    ActiveCell.FormulaR1C1 = "Has Proposal " & Chr(10) & "Document"
    Range("Table27[[#Headers],[Project Document ""Pass""]]").Select
    ActiveCell.FormulaR1C1 = "Has Project " & Chr(10) & "Document"
    Range("Table27[[#Headers],[Has a Project Description]]").Select
    ActiveCell.FormulaR1C1 = "Has a Project " & Chr(10) & "Description"
    Range("Table27[[#Headers],[Tag Status]]").Select
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 5
    Range("Table27[[#Headers],[Abt Organization]]").Select
    ActiveCell.FormulaR1C1 = "Abt " & Chr(10) & "Organization"
    Columns("J:J").Select
    Selection.ColumnWidth = 14
    Columns("H:H").Select
    With Selection
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlTop
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.ColumnWidth = 70
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Columns("C:G").Select
    Selection.ColumnWidth = 16
    Columns("C:C").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 13434879
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
Your assistance is appreciated. Thanks.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can't put formula in a table header and that seems to be what you are doing.
 
Upvote 0
Quick guess...
Edit your headers BEFORE you make the table... see if that works.
also, you can always remove scroll lines from your code.
Anything like this
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
is deletable
 
Upvote 0
Solution
Try it like
VBA Code:
Range("Table27[[#Headers],[KHub Project Completeness]]").Value = "KHub Project " & Chr(10) & "Completeness"
 
Upvote 0
Hi Folks,
Editing the headers before making the table worked.
Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,780
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top