Home Including a notes column in an excel query
Reply: 1

Including a notes column in an excel query

Ryan Published in 2018-02-14 19:15:01Z

I'm looking to include a notes column next to a query from an incident management site and to also make sure that the header row stays the same size.

Here's what I have so far. When I run it, it includes the notes in the table so they will refresh and follow the different incident statuses without losing the notes, but the way I wrote it doesn't allow for new rows.

The header row sizing isn't super essential, but that isn't working at all.

Any help would be greatly appreciated!

Sub IncludeNotes()
' IncludeNotes Macro

    Application.CutCopyMode = False
    ActiveSheet.ListObjects("Table_query").Resize Range("$A$1:$X$506")
    ActiveWindow.ScrollColumn = 1
    Selection.RowHeight = 65

End Sub
chris neilsen
chris neilsen Reply to 2018-02-14 21:47:01Z

Here's your code refactored to expand the ListObject by one column, and not change the number of rows. Also tidies up the code, removing the unnecessary Selects etc, and resizes the header row regardless of what row it's on

Sub IncludeNotes()
    Dim lo As ListObject
    Application.CutCopyMode = False
    Set lo = ActiveSheet.ListObjects("Table_query")
    lo.Resize lo.Range.Resize(, lo.Range.Columns.Count + 1)
    lo.HeaderRowRange.RowHeight = 65
End Sub
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.342501 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO