I would like to be able to sort Column A by it's self from the top to whatever the last cell entry falls, ignoring all the other columns. Is there a macro around that will do that? TIA
If you are new to macros Set the Security level to low/medium in
(Tools|Macro|Security). 'Launch VBE using short-key Alt+F11. On the left
treeview right click 'This Workbook '. Paste this code and save. Get back to
Workbook.
This will sort Column A everytime you open your workbook.
Private Sub Workbook_Open()
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A:A")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thank you very much. I have a couple of questions.
1. I have a header row can I change xlNo to xlYes?
2. The workbook sheet is 4 and named ItemList Can I use either 4 or ItemList
3. I realize the macro runs every time the workbook is opened. Which is not needed. I presume I can I run it whenever I make changes to that particular sheet?
--
Regards
Michael Koerner
If you are new to macros Set the Security level to low/medium in
(Tools|Macro|Security). 'Launch VBE using short-key Alt+F11. On the left
treeview right click 'This Workbook '. Paste this code and save. Get back to
Workbook.
This will sort Column A everytime you open your workbook.
Private Sub Workbook_Open()
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A:A")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
You can either reference as Worksheets(4). or Worksheets("ItemList").
3. I realize the macro runs every time the workbook is opened. Which is not needed. I presume I can I run it whenever I make changes to that particular sheet?
In VBE (Alt+F11) under the VBA project Treeview double click ThisWorkBook.
Cut and paste the code from _Open to '_SheetChange' or 'Before Save' event as
required...
You can either reference as Worksheets(4). or Worksheets("ItemList").
3. I realize the macro runs every time the workbook is opened. Which is not needed. I presume I can I run it whenever I make changes to that particular sheet?
In VBE (Alt+F11) under the VBA project Treeview double click ThisWorkBook.
Cut and paste the code from _Open to '_SheetChange' or 'Before Save' event as
required...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.