harveya915
Board Regular
- Joined
- Sep 4, 2015
- Messages
- 141
Got a sheet with a list of inventory items on column "A". Every week I insert 5 new columns from C-G with information for that item such as how many were used, restocked, total items, price of item, and cost of restocking. I created a text box, that will help adding inventory to the sheet (button1 opens a UserForm with a text box, description gets put into text box, "OK" button is clicked and the new item gets inserted in to the last row of column A.) Is it possible for when the new item gets added for it be inserted in alphabetical order/ sorted? I know excel has a built in sort/filter function, however I'm not sure if it will keep working considering the fact that I keep adding columns to the sheet and when applying the filter drop down buttons you have to select the cells to which you want it added to.
Below is the code i have for adding the part:
Below is the code i have for adding the part:
Code:
Private Sub CommandButton6_Click()
Dim emptyRow As Long
'Make Sheet1 active
Sheet1.Activate
Worksheets("Sheet1").Unprotect Password:="2019"
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 2
'Transfer information
Sheet1.Cells(emptyRow, 1).Value = TextBox1.Value
Unload UserForm2
End Sub