We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

How can I create a table like this in Excel?

Options
I want to create a table like this in an Excel document:

http://en.wikipedia.org/wiki/List_of_tube_stations#Stations

But can't find how to do it. Want it so it can sort long lists in alphabetical or numerical order when you click the headings, not sure if i've made that very clear?

Comments

  • Owain_Moneysaver
    Owain_Moneysaver Posts: 11,392 Forumite
    Part of the Furniture 10,000 Posts Name Dropper
    Depends on the version of excel you have. You need to make a sort button using some macro code.

    Discussion here.
    A kind word lasts a minute, a skelped erse is sair for a day.
  • You mean you want to take data from a website and import into Excel? If not then it's easy to do...
  • Mk14:37
    Mk14:37 Posts: 624 Forumite
    Part of the Furniture Combo Breaker
    Do you mean that you want to have 'sort' arrows at the top of each column?

    Highlight the top row, click Data > Auto Filter.
  • LucianH
    LucianH Posts: 445 Forumite
    Part of the Furniture 100 Posts Name Dropper Photogenic
    edited 21 June 2012 at 6:51AM
    Open up Visual Basic and add the following code to the Worksheet in question (will be listed under "Microsoft Excel Objects").

    This macro runs when you double click on the worksheet. It checks if you've clicked on the first row. If you don't then the macro exits without doing anything.

    If you do double click on the first row (and it's not blank) then the macro sets the sort area to all the data in the table and then sorts on the column you've selected.


    Option Explicit

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    Dim SortRange As Range

    If Target.Row <> 1 Then

    Cancel = False

    ElseIf Target.Cells(1, 1) = "" Then

    Cancel = False

    Else

    Set SortRange = Target.CurrentRegion

    SortRange.Sort Key1:=Target, Order1:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

    Cancel = True

    End If

    End Sub
    Never let it get you down... unless it really is as bad as it seems.
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.9K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.9K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.9K Life & Family
  • 257.2K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.