In the process of transitioning from Excel 2011 to Excel 2016 and have discovered that I cannot show a prompt with "application.inputbox" when asking the operator to select a cell or range.
I have worked around this by putting the description in the title bar, which does not make a lot of sense. A regular input box when the operators is asked to enter something works OK but that is not what I need. the code I am using is below.
Any suggestions greatly appreciated .
Peter
I have worked around this by putting the description in the title bar, which does not make a lot of sense. A regular input box when the operators is asked to enter something works OK but that is not what I need. the code I am using is below.
Code:
Sub SortSelCol()
Dim SortRng As Range, RngKey
Call LastCell
If Val(Application.Version) < 15 Then
Set col1 = Application.InputBox("Select 1st cell in Column to be sorted", Type:=8)
Else
'It appears that one cannot provide a prompt for application.inputbox on mac so have to show prompt in title
Set col1 = Application.InputBox("", Title:="Select 1st Row of Column to Sort", Type:=8)
End If
RngKey = col1.Column
Range(Cells(col1.Row, col1.Column), Cells(LRow, col1.Column)).Select
If col1.Column > 1 Then Selection.Interior.ColorIndex = 36
Set SortRng = Range(Cells(1, 1), Cells(LRow, LCol))
SortRng.Select
ActiveWorkbook.Worksheets("Indexed").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Indexed").Sort.SortFields.Add Key:=Range(Cells(col1.Row, col1.Column), Cells(LRow, col1.Column)), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Indexed").Sort
.SetRange Range(Cells(1, 1), Cells(LRow, LCol))
.Apply
End With
Cells(1, 1).Select
End Sub
Any suggestions greatly appreciated .
Peter