We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 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!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
How can I create a table like this in Excel?
liamcov
Posts: 660 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
- 353.6K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455.1K Spending & Discounts
- 246.7K Work, Benefits & Business
- 603.1K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.7K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards