Hello everyone,
I am making a list with a VBA Form to input information into different categories (columns).
In addition, I want the list to update automatically in alphabetic order firstly based on the entry in column A, and thereafter on the entry in Column B. I am currently trying to modify a piece of VBA code found on another forum (see below), but failing miserably as this is the first time I have worked in VBA.
Two issues: 1. Only the the input in Column A is sorted for, meaning that the corresponding input in other columns but for the same row are "lost" and do not move with the input in column A. 2. It (obviously) does not sort for the input in Column A first and thereafter the input in Column B.
Can anybody modify the code or maybe come up with a better solution?
Much appreciated /THE19
I am making a list with a VBA Form to input information into different categories (columns).
In addition, I want the list to update automatically in alphabetic order firstly based on the entry in column A, and thereafter on the entry in Column B. I am currently trying to modify a piece of VBA code found on another forum (see below), but failing miserably as this is the first time I have worked in VBA.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Range("A2").Sort Key1:=Range("A3"),_
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
End Sub
Two issues: 1. Only the the input in Column A is sorted for, meaning that the corresponding input in other columns but for the same row are "lost" and do not move with the input in column A. 2. It (obviously) does not sort for the input in Column A first and thereafter the input in Column B.
Can anybody modify the code or maybe come up with a better solution?
Much appreciated /THE19