We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
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

liamcov
Posts: 643 Forumite


in Techie Stuff
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?
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?
0
Comments
-
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.0 -
You mean you want to take data from a website and import into Excel? If not then it's easy to do...0
-
Do you mean that you want to have 'sort' arrows at the top of each column?
Highlight the top row, click Data > Auto Filter.0 -
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 SubNever let it get you down... unless it really is as bad as it seems.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

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