• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Order Sort Need 2 option through VBA

Hi I am trying the VBA in Excel 2013

I have mention the list in "Sheet1" for order

I want the Order Sort need 2 option in "Sheet1"

Note: Except the "Sheet1", because, this sheet is use only as Master sheet, otherwise sort order

1st option is order sort based on "Serial Number"
2nd option is order sort based on "Sheet Name" for alphabetically wise (it may be A-Z or 1, 2 , 3, etc., ascending order wise)
 

Attachments

  • Book2.xlsx
    10.8 KB · Views: 3
Tnq for response, but i got the error. image enclosed

When i do the macro, that time the dialog box is ask me, you want to run 1 option or 2 option

Tnq

63897
 
sivaprakasam
Did You noticed:
Have You ever read or tried Macro Recorder?
Question needs answer!

I cannot get any error ... then it's a challenge.
I modified layout.
 

Attachments

  • Book_2.xlsb
    22 KB · Views: 5
Hi !​
As vletm's codes can not work under 2013 and older Excel versions,​
according to the initial attachment next event demonstration works by double clicking on a header name,​
you must paste this code to the (Sheet1) worksheet module :​
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    With [A1].CurrentRegion
     If Not Intersect(.Rows(1), Target) Is Nothing Then Cancel = True: .Sort Target, xlAscending, Header:=xlYes
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Back
Top