Sort From Onclick Of Header

Jan 17, 2010

Attached is an example page. My goal is to be able to click on one of the header cells, and have it sort that column from high to low, and if I click that same cell have it sort from low to high. I know how to do this by making a command button, but, I want to do it by clicking on the cell itself. I just dont know how to do the onclick to execute the code.

View 3 Replies


ADVERTISEMENT

Data Sort By Header

Jul 19, 2007

what is the code to sort a spreadsheet in VBA code by HEADER rows?

i have 2 rows i want to sort by: first by Column D row 1, then by column C row 1.

Cells.Select
Range("C1").Activate
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Range("C2").Select

selects all cells, sorts, then de-selects.

View 3 Replies View Related

Column Header As Sort Tool

Apr 14, 2008

Came across a spreadsheet that my firm created, where you can click on the column header and it automatically sorts ascending order for the column without messing up the other columns. Then if you double click it again, it will sort in reverse order.

View 9 Replies View Related

Select And Sort In List By Header

Jul 25, 2007

I have a spreadsheet which contains a list of chemicals in Column A, and a list of numbers in Column B. The chemicals are separated into groups. I am trying to create a macro which sorts the chemicals in their groups by column B, so that the lowest number is at the top. I have 8 groups, and the number of lines in each group may vary, so I need to make the code dynamic.

I have attempted it. The way I thought it could be done was to search for the first group header, then save the address. Do the same for the next group header, then offset that by -1 row and 1 column, then sort using these two addresses as the range. The first part of the code works, where I find the address for both group headers, but everything after that doesn't work.

Sub Sort()
Dim CNMT(8) As String
Dim j As Integer
Dim fromRow As String
Dim toRow As String
Dim rng1 As Range
Dim rng2 As Range
CNMT(1) = "TPH Fractions"
CNMT(2) = "BTEX & MTBE"
CNMT(3) = "PAHs"
CNMT(4) = "VOCs"
CNMT(5) = "SVOCs"
CNMT(6) = "Metals"
CNMT(7) = "Inorganics"
CNMT(8) = "Pesticides"
For j = 1 To 8..................

View 2 Replies View Related

Sort Data With Two Header Rows

Apr 30, 2008

I have two header rows on a sheet that I need to sort starting on Row 3, Column A.

The sheet is A-K and rows 1 and 2 are headers

Row 1 has merged cells of A-F which says "Information" and then G-K " Tracking Section"
Row 2 is broken up into individual sub-headers in columns, A-K each one having a bit more info for instance:

Under the "Information" merged header in row 1 there is
A2 Name
B2 Work Center
C2 C/O date
D2 Due CC
E2 Due MX
F2 Date Received

and G-K in row 2 has different sub-headings.

I have tried to use my normal code, which is great for one header, but it ends up sorting the sub-header as I call it...

View 5 Replies View Related

Create List With 2 Or More Same Subject/Header For Sort

Feb 25, 2009

I would like to create a list covering multiple columns.
I would like to have 5 columns which will contain the same value/ (word).
If I select,that value from the list, I would like to have each row the word is
found be displayed regardless of which row it is found.

View 7 Replies View Related

Sort Data By Clicking On Header Row Cells

Oct 7, 2009

In the worksheet "Batting and Pitching Register", I'd like to be able to sort the data in the two charts (APBA Batting Register and APBA Pitching Register) by simply clicking on the cells in the respective header rows.

I've set up ranges (Batting and Pitching), but have had no luck moving beyond that.

View 9 Replies View Related

Possible To Sort Hoizontally With Multiple Columns Under One Header

Aug 6, 2008

In row 1 I want to have the names of servers, so we would have A C D E

Under each of those I want to have 4 other columns, so A would have on row 2 Start, End, Data, Time, or something like that.

Then B would have under it Start, End, Data, Time

And so on for C D ...

I would then want to sort it by the top level row, so if I had to insert B at the end I could sort it so it would be

A B C D E with all of the Start End Data and Time for the server to be moved along with it's master header.

I tried setting this up but then I went to sort it told me it could only sort if the columns were the same size, so having a merged top level A with four things under it did not work.

View 9 Replies View Related

Event OnClick - Show Smart Art Shapes Below (child)

Oct 10, 2012

I'm trying to make a menu in my Workbook to access all the others sheets.

To make things easier for my boss, I'm trying to make the menu with SmartArt Shapes (Hierarchic) because it's easier to add/remove itens.

The thing is: he wants it to show the boxes below (hierarchic child) when i click the "mother" box.

It will work pretty like web menus except the mouseover. Image below

menu.jpg

View 1 Replies View Related

Rearrange (sort) Columns Based On Number In Column Header String

Apr 3, 2014

I want to rearrange(sort asscending) columns based on numerical value in column header string through VBA macro. Please check attachment.

i.e. (Present Data)
# A B C D
1 col.1 col.4 col.3 col.2

(Output Data )
# A B C D
1 col.1 col.2 col.3 col.4

test.bmp‎

View 2 Replies View Related

Macro To Sort And Align Employee Data In Multiple Cols To A Header Row

Jul 9, 2014

I have an issue with an export file which is produced in CSV format and needs to be aligned. I have attached a sample of what I refer to.

My Source excel file looks like:

ABC A-101 B - 202
DEF B-203 C - 100

The destination should align with the relevant column headers and place a blank if it doesn't match. Other have queried a similar thing, however my header and data and description is actually in the same cell with a dash separating them.

The output I want is:

A B C D
ABC 101 202
DEF 203 100

There are multiple row of employees with varied column headings as its dependent on what system access the user has. The headings i.e. A,B,C for example is a fixed number of headers.

In my real data set the headers represents a 3 letter system prefix e.g. ZCR,ILP etc

View 1 Replies View Related

Excel 2010 :: Sort Growing Column Starting Under Header Row At Cell C5

May 7, 2014

find macros to sort fixed ranges but not an entire column with existing header rows from 1 to 4.

Added to that is the need to keep the code compatible with Excel 2003 even though I have Excel 2010 at office (it's a file that needs to be "openable" in both versions so the vb code needs to be in XL 03.

Column currently starts at C5 but goes down to C47, at this point. But it's a growing list. Some of the rows are blank at the bottom, too.

View 2 Replies View Related

Link A Header Or A Portion Of A Header To A Specific Cell

Jun 23, 2008

Is there a way to link a header or a portion of a header to a specific cell?

View 14 Replies View Related

Return Column Header If Row Header And Value Is Known

Nov 18, 2011

I've been trying find an appropriate formula to extract the column header from a table in a different sheet if the row header and value in that table is known.

in the lookup table the row titles (column A) are product codes, column titles (row 2, D through AX) are business names and the table values are quantity.

In a different table I have product codes in column A and in column B i have the max number/quantity of products for that code. In column C i want to put the company name associated with the product and the number/quantity.

View 4 Replies View Related

Rank & Sort Table: Unique Numbers Sort Ascending, But The Non-unique Numbers Sort Descending

Oct 5, 2007

I have a list in rows where I have a ranking formula =COUNT($G$5:$G$81)-(RANK(G5,$G$5:$G$81)+ COUNTIF($G$5:G5,G5)-1)+1 When I sort the rank, ascending. All of the unique numbers sort ascending, but the non-unique numbers sort descending

ex) 1.751
2.52
3.753
418
417
416

View 5 Replies View Related

Move And Sort With One Column But Insert Extra Columns As Needed For Proper Sort?

Jan 13, 2014

Using DataEntry sheet for data.
Trying to rearrange the data to DataFormatedProperly sheet.
So far all I can accomplish is DataFormatedWrong sheet.

Edit: Not sure what happened but file was NOT understandable before. It should be correct now.

View 2 Replies View Related

Sort Command - Custom Order Or Sort Ascending Or Descending

Oct 8, 2006

Is it possible to make excel sort ascending or descending but from mid way through alphabet and then loop through the alphabet again. for example. If Cell A1 had "A" in, it would sort as normal.

Cell A1 = A
Cell A2 = B
Cell A3 = C
Cell A4 = D
Cell A5 = E

If Cell A1 had "C" in, it would sort from "C" through the alphabet and then loop to the start of the alphabet as shown below.

Cell A1 = C
Cell A2 = D
Cell A3 = E
Cell A4 = A
Cell A5 = B

View 4 Replies View Related

Sort Worksheets Using Custom Sort To Choose Certain Word?

May 30, 2012

As of right now these are the steps i do to sort...i click custom sort choose My data has headers and then i select from the drop down list the word FRNAME.

is there any way i can setup a macro to do this for me? i tried recording the macro but it just is recording me choosing the column FRNAME is in. This does not work for me since FRNAME end up being in different columns all the time but will always be in row 1.

View 1 Replies View Related

Page Header: Print The Header On Page One Only

Mar 5, 2009

I have a booklet I want to print from Excel 2000. I'm not seeing how to have the HEADER on page one only. The header is coming up on all pages. Is there a way to tell Excel to print the Header on page one only?

View 2 Replies View Related

Sort / Filter Rows: Sort A Range Of Row

Nov 26, 2008

I would like to ask if it is possible to sort a range of row? What I mean is, if I sort like Row 1, the entire block of row 1 will move as well? Like if i have column A to F, then row 1 of column A to F will move together at the same time.

View 3 Replies View Related

Macro To Sort Colums And Protect After Sort

Nov 5, 2009

I am looking for a macro to sort my colums in ascending order the range i need sorted is from A7:F107, it will be sorted with the numbers in the A column ie 1 - 107. sometimes different numbers get added and it has to be sorted in number sequence.

If possible i would also like a macro to protect this range after the sort,

View 3 Replies View Related

Sort - Defined Sort Criteria

Sep 20, 2006

I have an Overview sheet within my workbook that contains info from all other sheets.

What I want to do is when you click on the Sort button in the General sheet it will activate the Overview Sheet and

- first off sort all sheets starting with AJ together, then all sheets starting with CJ together and then all sheets starting with PJ

- then the next thing i want it to do is sort all Ajs by their start dates, sort all CJs by their start dates and the same for all PJs.

Now up until now I was keeping all sheets that began with AJs together in the workbook and so on so I was able to use the following sort function

Sub Overview_sorting() ...

View 5 Replies View Related

Sort Horizontally. Sort Across Columns

Dec 30, 2006

I am trying to sort a long range of text that is placed horizontally in a spreadsheet. I can do it vertically with the sort function in Excel but it does not seem to work for text that is placed horizontally. Example is as below:

Inventory Accounts Human Resources

View 2 Replies View Related

Sort And Group Names Then Sum Associated Numerical Values For Each Group - Sort Total

Apr 18, 2014

I have this massive spreadsheet, with the maximum rows excel will fit on one sheet. In the interest of simplicity, this is what the raw data looks like:

Last First Amount

Jones Jim $1000
Jung Joe $700
White Jon $100
Jones Jim $200
Jones Jan $300
Jung Joe $800
White Jon $200

What I want to do is automatically get excel to group all the same names together. Then I want it to sum all the values for each name, then order by largest total value for each person, then order that by name alphabetically. In other words, the above would look like this after the sort:

Last First Amount
Jung Joe $800
Jung Joe $700
Jones Jim $1000
Jones Jim $200
Jones Jan $300
White Jon $200
White Jon $100

Or, if necessary, there could be sum total rows under each name...although I don't have spare rows, so IDK. I could delete some rows if I had to, but would rather not.

View 1 Replies View Related

Sort Tabs By Color And Sort Color Groups Alphabetically

Oct 14, 2012

I've located the following color sort VBA that sorts worksheets by color and it is working well. I'm trying to modify the code to sort each of the "color grouped" sheets alphabetically. That is, sort by color and then each color group sorted alphabetically.

VB:
Sub SortWorksheetsByColor(Optional ByVal SortByAsc As Boolean = True)

Dim i As Long
Dim j As Long
Dim ShtC() As Long
Dim ShtN() As String
Dim t, n As Long
Dim lngSU As Long

[Code] .....

View 5 Replies View Related

VBA Code To Sort Data - Run-time Error When No Data To Sort

Mar 4, 2010

I havet he following code which sorts data. If there is no data to sort I keep on getting a run time error. Could I add something to my code to prevent the run-time error, as sometime there won't be any data to sort. The code runs when I switch to the worksheet in question.

Sub SortMeetings()
Dim iCTR As Integer
Dim yCTR As Integer
Dim zCTR As Integer

zCTR = 11
For iCTR = 12 To 23
For yCTR = 1 To 10
If Len(Range("D" & iCTR).Offset(0, yCTR)) 0 Then
Range("AA" & zCTR).Value = Format(Range("D" & iCTR).Offset(0, yCTR), "HH:MM") & " " & Range("D" & iCTR).Value
zCTR = zCTR + 1
End If
Next yCTR
Next iCTR
Range("AA11:AA" & zCTR).Select
Selection.Sort Key1:=Range("AA11"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

View 9 Replies View Related

How To Get Header By Matching Value In Row

Dec 6, 2013

Attaching the excel (QOS- ARP- Applications.xlsx) - Formula I am trying in D27, "X" value is there in the row and the corresponding application (Header ) should be the return in D27.

View 1 Replies View Related

Getting Value From Next-highest 'header' Row

Jan 28, 2009

I have a worksheet that contains a number of rows. [Thank you, Captain Obvious!] These rows are logically grouped to represent a series of "items", with each item having one or more rows (with a "header" row at the top). The rows for a particular item represent different types of information about that item, and therefore make use of different formulas based on the row type. Due to the relative complexity of the formulas in these rows, I am creating a series of row "templates" from which I can copy and paste every time I want to create a new item or add rows to an item. As such, I am trying to avoid direct cell references to different rows, as these would easily get messed up during cut and paste. Instead, I am trying to limit myself to various lookup functions (e.g. OFFSET, MATCH, etc...) that will work regardless of where a row is added.

In order to accomplish this I am using a "key" column to group all rows for a particular item together. Until now I have had to type in the key value for every row for a particular item. What I would like to do is to only have to type the key value in the header row, and have a formula populate the key value in all subsequent rows ... until a new header row is reached, at which point the new key value will be used. Take a look at the following example: ....

View 14 Replies View Related

Header On Every Page

Apr 8, 2009

it was possible to have my header which is in row1 to printed at the top of every page without having to manually put it at the the top myself. this is for printing only as i have frozen panes to make sure its always visible when in spreadsheet

View 4 Replies View Related

Regarding Header And Footer...

Sep 18, 2009

Is there any way in excel 2007 to define a standard header and footer on the first sheet and use the same header and footer for all the remaining sheets within the workbook (same font and style as in first page).

Since I have around 25 sheets within the workbook i cannot do formatting and copy paste all the time. This will save my time alot.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved