Sorting Table - Macro Error
Jan 5, 2013
Created the following macro, but doesn't seem to work.
Sub SortTable()
With Range("TC_Table")
.Sort key1:=Range("TC_Table").Cells(1, 1), Order1:=xlAscending
.Sort key2:=Range("TC_Table").Cells(1, 2), Order2:=xlAscending
.Header = xlYes
[Code] .....
View 7 Replies
ADVERTISEMENT
Jun 17, 2014
I have a table of 5 columns (each of 50 length) that is automatically refreshed (i am getting the data from web)after an interval of 5 minutes. I want the first column to be sorted alphabetically after every 'refresh' command, that has been executed by the excel. i have tried recording the macro and then running it on keystroke of 'ctrl + m'...the table surely gets sorted out but i can't be pressing ctrl+m every 5 minutes. auto-sort that is required to be executed after the auto refresh command..
View 6 Replies
View Related
Jul 22, 2014
In creating a macro and creating a pivot table as one of the first steps, I get this runtime error in visual basic:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"original working!R1C1:R1000C13", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="Sheet4!R3C1", TableName:="PivotTable2" _
, DefaultVersion:=xlPivotTableVersion14
View 5 Replies
View Related
May 8, 2008
I don't understand why when I try to sort the pasted selection I get an error!! I just copied a list from one workbook into another and I am trying to sort that list ascending. Once I get to the sort line I get a run time error.
Windows("book1.xls").Activate
Sheets("A").Activate
ActiveSheet.Range("D2").Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
View 9 Replies
View Related
Jun 5, 2014
I have been working on a spreadsheet with 28000 lines and I have gone through and resorted, researched and completed the spreadsheet over the last couple weeks. When I went to change it back to a CSV file to give back to the vendor, I realized that at some point when I sorted the list I mixed up the unique identifier (I at some point did not sort the UID only the other columns) and because I have resaved this file over itself I only have the original CSV file to go back and reimport... but dont have time to look up each of these 28000 lines again. I am looking for a way to take a cell from my final spreadsheet (Spreadsheet A) then find it on the original CSV spreadsheet (Spreadsheet B) then copy the UID field from speardsheet B to a blank field in spreadsheet A.
View 2 Replies
View Related
Nov 5, 2009
I am trying to write in VBA sorting button but I am receiving error 1004. I have recorded Macro while selecting 2000rows and sorting it by B then C then A. Columns go to T and some of the columns are empty. However, first 3 lines are completely filled. This is what I have got from recorder(I have adjusted first 2 lines to suit)
View 2 Replies
View Related
Oct 12, 2008
I have a long list of records/rows. Each record has about 22 cells (columns).
Recently the number of records/rows exceeded 1400 and I started noticing that Excel no longer can sort my records correctly. I sort them according to the first column, which is called PRIORITY. And these values go from 0-2500 and more. But very often my list looks as follows
2500
2437
2355
102
108
107
2102
169
1982
1970
And so on.
The funny thing is if I sort less than 1400 entries, it does it right. Actually, the cutoff line is somewhere between 1410 and 1425. Usually below 1410 it will work fine, above 1425 it will not, and between 1410 and 1425 it is erratic.
View 9 Replies
View Related
Aug 14, 2012
I am trying to create a macro where users can rearange data in a table. I used the macro recorder to sort the data in colmn C in descending order and this is the code that I got:
VB:
ActiveWorkbook.Worksheets("By Client").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("By Client").Sort.SortFields.Add Key:=Range( _
"C3:C176"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("By Client").Sort
[Code]...
This works for the table as it is but the range may change as more rows are added to the table. I want it to start at row three as the first two rows are headers but in future tables the bottom row may not be 176. I dont want to include all rows as row 177 contains totals that I dont want to be included in the sort. what I should put as the range so that this macro will work regardless of how many rows are in the table?
View 3 Replies
View Related
May 23, 2014
I am trying to sort by date in a table (It is named Linked_file_table), C173:I188. I would like the table to be sorted by I173 AZ.
View 1 Replies
View Related
Oct 15, 2008
I have managed to produce a table which uses formulas to calculate the amount of 'points' someone/a team has accumulated over a period of time however it seems that for some reason or another I cannot sort the table into order of 'who has the most points'
PosPlayerPlayedWonDrawLostPoints
1stDean120939
2ndJaymo1239018
3rdMacca1229115
4thRoss1219212
above is the final standings but as you can see the 'sort' function isnt working, and if i do any other sort the name of the person and the points no longer correspond... i.e. it ends up putting the names in alphabetical order and leaving all other columns as they currently are, or it changes the points column, leaving the names in the same place...
View 14 Replies
View Related
Jun 9, 2009
I've just come across Excel doing seemingly doing something really rather daft - though it equally could be me. I've grouped dates in a pivot table to 7 days at a time to group weeks, but when I then sort by date order it sorts by all those ranges starting with a 1st of the month, followed by all the 2nd's, etc.
View 3 Replies
View Related
Jul 30, 2013
Trying to format a pre-formated table. Would like to have all records for each item on one line so to be able to create a regular table and then a pivot table from it.
Pre-formatted table is attached as Samplesort1.xls.
I do not have SQL.
Is it possible to do this without macros?
View 1 Replies
View Related
Nov 24, 2008
I've got this table that I want to sort. I've got it formatted as a table in Excel 07.
ABDescription
11Sunbake
24Make Sandcastle
35Apply Sunscreen
46Sip Coconut Mocktail
52Play with kids
66Seashells
72Starfish
83Swim
91Snorkel
2Surf
3Boogieboarding
4Eat Icecream
1Play beach volleyball
I'd like to sort the table where all the 1's are together and in line with column A ie......
View 2 Replies
View Related
Jul 10, 2009
Is it possible to have dynamic sorting in a table?
What I am after is a scoreboard type effect where as results are entered, the teams are sorted automatically, rather than entering all of the details and then doing a sort afterwards.
I have attached a table where I would like the sorting of columns B - E done in the following order (All decreasing order):
Comp Points first
then by Sets %
then by Points %
I am drawing this info from another table. Will this have an effect on if it can be sorted dynamically? Hoping that as i enter a result in the other table, it will bring across the current comp points, set % and points %, and then sort the table into the rankings all at once.
View 10 Replies
View Related
Jan 11, 2008
I have created a pivot table that contains the following data:
Country Name
Date as in 5/1/08, 6/1/08, etc
With counts in the cells
I can sort on Country name and get an alphabethical list by country name showing teh numbers for each date
However I want to sort by the largest to smallest number that shows in the date column 01/01/08
Is there a way to sort on that colum-while moveing all the numbers in the other date columns along with it?
View 9 Replies
View Related
Mar 18, 2014
I've got large set of data(Column E) for dates from 2007 to 2013(Column B). Here dates are in chronological order.(Attachement) Now I want to match the data in to dates in Column H. Here dates are in random order. I used =INDEX(E3:E40582; MATCH(H3;B3:B40582; 0)). But it doesn't work.
View 5 Replies
View Related
Mar 17, 2014
I'm trying to sort a table as displayed in the image below. The table consisting of items in column A, here fruits, and a column E where totals over three month is displayed.
I have entered an array formula in column H where the total of each fruit is summed and then sorted in descending order. My problem is that whenever two fruits have equal value (here, apple and pear), Excel will not manage the display of both fruits, it will just display the first twice. The formula in column I is a simple SUMIFS.
It doesn't matter if Apple or Pear is displayed first, but I need both items to be displayed in column H.
excel1.png
View 5 Replies
View Related
Apr 28, 2014
I would like to know If we can sort the pivot table data in a bunch of Groups. e.g 50 years based on decades. currently I am able to group only once in a given range. but I would like to define several more ranges e.g 1970-1990 and 1990-2010 and etc
View 2 Replies
View Related
Feb 21, 2014
So i have a column full of first and surnames (both names in one cell). Is there a fast way to arrange them in alphabetical order? (surnames)
View 2 Replies
View Related
Jan 13, 2010
I can't seem to be able to find out how to sort data within a pivot table.
I have about 1000 different names that have data values for two years. I have a calculated field to show the difference....
View 8 Replies
View Related
Dec 27, 2012
I have a birthday list with name, client, birthday. I want to create a pivot table that groups by month. Report layout is tabular. Then within that month, name, client & birthday (in date order). So my end result would look like;
January Jim Jones Company 1/4
Then rest of January names 1/15
Etc.
Right now, I can't get the birthday to sort by date within the month.
View 1 Replies
View Related
Jun 12, 2014
I am having the hardest time trying to get my pivot table to sort right. I downloaded data over a 7 year period and its sorted by months (January-2005 etc). The issue I am having is excel is putting it into this format
January-2005 January- 2006 ......... February - 2005 February-2005.
I need it to sort chronologically
jan 2005, Feb 2005, March 2005...... Jan 2006, Feb 2006 etc.
What do I have to do to get this fixed. I would rather do not have to do it manually each time I need this type of data.
View 3 Replies
View Related
Jan 6, 2009
So, I have a table of scores from players for a category I have. It looks like this:
Place-------------Name-------------Country-------------Score
1st---------------Jim----------------USA--------------------376
2nd--------------Michael-----------Germany-------------364
2nd--------------Tim---------------USA-----------------364
4th---------------John--------------Norway-------------355
if one of the guys, for example, John were to improve his score to a 369, I'd change the score in Excel, then use the sort feature to put him above Michael and Tim. Only problem is, it would say his place is still 4th place, and it doesn't change to 2nd place.
I want it so the "Place" column automatically changes to the correct rank based on the score the person has. So if I changed John's 355 score to 369 and hit sort by A-Z, Excel would automatically change the "Place" he's in appropriately so it would look like this:
Place-------------Name-------------Country-------------Score
1st---------------Jim----------------USA--------------------376
2nd--------------John--------------Norway--------------369
3rd---------------Michael-----------Germany-------------364
3rd--------------Tim----------------USA-----------------364
View 9 Replies
View Related
Jun 2, 2006
I have a pivot table and i am trying to display the rows in order of relevance. I have a bit of code that will sort the rows into the order I want them which I have included. My problem is that sometimes I will have rows that will not be there, If position 3 doesn't exist I would expect it to display 1,2,4,5 but instead I get an error message.
ActiveSheet.PivotTables("PivotTable11").PivotFields("Baan Order").PivotItems("Nomination") _
.Position = 1
ActiveSheet.PivotTables("PivotTable11").PivotFields("Baan Order").PivotItems("Full") _
.Position = 2
ActiveSheet.PivotTables("PivotTable11").PivotFields("Baan Order").PivotItems("Equal") _
.Position = 3
ActiveSheet.PivotTables("PivotTable11").PivotFields("Baan Order").PivotItems("Target") _
.Position = 4
ActiveSheet.PivotTables("PivotTable11").PivotFields("Baan Order").PivotItems("None") _
.Position = 5
View 2 Replies
View Related
May 30, 2014
I have some data formatted as a table. There are some blank rows at the end that still contain formula.
Every time I sort the data these rows move to the beginning. I have tried only selecting the active rows of data, but the whole lot defaults in each time
How do I sort data with a selected range only (within a table)?
Don't really want a macro as this will need to be used by others
View 1 Replies
View Related
May 11, 2014
I'm selecting only some rows in a Table trying to sort only these rows (e.g. rows 11 thru 75 in a 200 row table), but when I hit Sort Excel always overrides my selection by selecting all the rows in the table instead. The same thing happens in VBA. I'm using Excel 2007.
View 12 Replies
View Related
Sep 18, 2009
Optionally, to customize the sort operation, on the Options tab, in the Sort group, click Sort. In the Sort <Field name> dialog box, select the type of sort that you want by doing one of the following:
To return items to their original order, click Data source order. This option is only available for OLAP source data. To drag and arrange items the way that you want, click Manual.To select a field to sort by in ascending sort order, select Ascending (A to Z) by, and then select the field from the drop-down list. To select a field to sort by in descending sort order, select Descending (A to Z) by, and then select the field from the drop-down list. Tip Read the Summary section at the bottom of the dialog box to verify your choices.
My problem is this: after following the above steps, then clicking Manual, then ok, I cannot drag and arrange the row labels in the PivotTable.
View 2 Replies
View Related
Apr 10, 2013
Using Excel 2010
I have a workbook with multiple sheets.Sheet1 is named "UPC" and is a giant database for my workbook containing 80,000+ rows and 12 columns.
Sheet2 is named "Scan" and uses a bunch of index-match formulas. Basically, you scan a barcode and it auto-populates across the row all the information it pulls with that particular UPC from the "UPC" sheet. One of my columns, "QTY Scanned", in the "UPC" sheet has a countif formula to keep track of how many times that item was scanned on the "Scan" sheet.
Sheet3 is named "PSlip" and has a big button on it that you press and multiple macros go into overdrive. First macro takes all the rows from "UPC" with a quantity greater than 0 in the "QTY Scanned" column and copies it to the "PSlip" sheet.
Second macro takes that data and makes a pivot table.This is all clothing, pants, shirts, jackets, etc...When my pivot table is created, my Column Label is Size. When the pivot table is created, it automatically sorts it in ascending order, so it goes from numbers to letters.
This is great for pants because the size is in reference to a waist size; 24,25,26,27, etc...
HOWEVER, shirts, jackets, and other tops are not in a numeric size: they are in a Text format. XS, S, M, L, etc...
Sometimes we only scan pants for an order, sometimes only tops, sometimes both.
Is there a way for the pivot table to recognize when tops are in included and automatically sort the sizes?
I still want the numeric values at the beginning, but once the text starts it automatically sorts in this order:
XXS, XS, S, M, L, XL, XXL, MT, LT, XLT, XXLT, 1X, 2X, 3X, 4X, 5X
View 2 Replies
View Related
Jun 21, 2013
I am doing a macro that will access a specific sheet of my workbook, a specific table, and will sort the table according to the field "Nominal", from largest to smallest. I have tried with this but it doesn't work:
Sheets("F.C.SSA-View 2").Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("F.C.SSA-View 2").ListObjects("F.C.SSA_View_2").Sort.
SortFields.Clear
ActiveWorkbook.Worksheets("F.C.SSA-View 2").ListObjects("F.C.SSA_View_2").Sort. _
[Code] ....
View 1 Replies
View Related
Mar 18, 2007
i have generated a olap cube and display it using pivot table. But i am unable to sort my data from acsending order. For example: I had right clicked on my pivot table > field settings > Advanced > Select "Ascending". The data (sum of quantity) remains unsort after i have checked ok.
View 2 Replies
View Related