Hey,
beginner question...
I have four column on a worksheet, each column is a list of numbers.
i wish to create a message box, where the user can input the column number and then be able to sort which column he has selected.
here's what i have so far, it's not working, so i'm going to assume that something's fundamentally wrong...
Sub userinput()
MsgBox InputBox("Which exam would you like to sort?", "Sort Exams"), vbInformation, "User's Choice"
If vbInformation = 1 Then
Call sorting1
End If
If vbInformation = 2 Then
Call sorting2
End If
If vbInformation = 3 Then
Call sorting3
End If
If vbInformation = 4 Then
Call sorting4
End If
End Sub
Sub sorting1()
With ActiveWorkbook.Worksheets("sheet1").Sort
.SetRange range("B4:B18")
.Apply
End With
End Sub
Sub sorting2()
range("C4").Sort key1: range ("c4:c18"), order1:=xlDescending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
Sub sorting3()
With ActiveWorkbook.Worksheets("sheet1").Sort
.SetRange range("D4:D18")
End Sub
Sub sorting4()
With ActiveWorkbook.Worksheets("sheet1").Sort
.SetRange range("E4:E18")
End Sub
Bookmarks