+ Reply to Thread
Results 1 to 4 of 4

Double Click Ascending Order

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-19-2012
    Location
    Sydney
    MS-Off Ver
    MS Office 365/16
    Posts
    282

    Double Click Ascending Order

    When I double click the tab sheet2!C1 to Sheet2!H1 I am able to get them from ascending order (highest to lowest). When I go back to double click sheet2!B1 the column goes in alphabetical order but none of the other columns change with it.

    Please see the attached file. There is VB coding.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Double Click Ascending Order

    I think you mean to deal with Sheet1 not sheet("details")
    Try this change
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        If Intersect(Target, Range("B1:H1")) Is Nothing Then Exit Sub
        Dim I&: I = Target.Column
        Cancel = True
    
        If I = 2 Then
            With Range("B2:H" & Cells(Rows.Count, 2).End(xlUp).Row)
                .Sort Key1:=.Cells(1, I - 1), Order1:=xlAscending
            End With
        Else
            With Range("B2:H" & Cells(Rows.Count, 2).End(xlUp).Row)
                .Sort Key1:=.Cells(1, I - 1), Order1:=xlDescending
            End With
        End If
    End Sub
    Last edited by YasserKhalil; 11-13-2015 at 07:12 AM.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    08-19-2012
    Location
    Sydney
    MS-Off Ver
    MS Office 365/16
    Posts
    282

    Re: Double Click Ascending Order

    Works a treat. Thank you very much. This forum never seems to amaze me with their generosity. It's always appreciated

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Double Click Ascending Order

    You're welcome.
    Thanks a lot for your kind words and for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Double click cell - copy data to new sheet - create a list from double clicking
    By kakky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-04-2015, 11:14 PM
  2. [SOLVED] Add 1 to target on double click, add 0.5 on shift + double click
    By MarmaladeLover in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2015, 06:59 AM
  3. [SOLVED] Before double click event with if statements (Double clicking blank cell stops bdc firing)
    By camdenpars in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2014, 09:03 AM
  4. Changing cell properties with double click, then revert with another double click
    By mweber2525 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-01-2014, 01:40 PM
  5. Copy double-clicked cell to next empty row in different sheet with each double-click
    By erhathaway in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-25-2013, 12:06 AM
  6. [SOLVED] userform label double-click goes to click event
    By John Paul Fullerton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2006, 01:00 PM
  7. Click on graph bar to execute a double-click in a pivot table cell
    By Bill_F_Lyle@fpl.com in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 08-02-2005, 09:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1