Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a sortable column
I would like to create a macro that would insert a column into a
spreadsheet which I can then sort by. Not being familar with creating macros, I am looking for any guidance on how to get started. What the macro needs to do is as follows: 1) insert a column into the active spreadsheet as the first column. 2) starting with the active cell in this newly inserted column, populate it with A1,B1,C1,A2,B2,C2,A3,B3,C3, and so on until there is no more data in the second column. I'll also need to know how to save this macro so that I can use it over again. Any help on this is greatly appreciated. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a sortable column
Sub SortMyData()
Dim rng As Range, i As Long, J As Long Dim cell As Range Columns(3).Insert Cells(1, 3).Value = "HeaderC" Set rng = Range(Cells(2, 2), _ Cells(Rows.Count, 2).End(xlUp)) i = 1 J = 64 For Each cell In rng J = J + 1 cell.Offset(0, 1).Value = Chr(J) & i If J = 67 Then J = 64: i = i + 1 End If Next Cells(1, 3).CurrentRegion.Sort _ Key1:=Cells(1, 3), Order1:=xlAscending, _ Header:=xlYes Columns(3).Delete End Sub -- Regards, Tom Ogilvy "rsine" wrote in message ... I would like to create a macro that would insert a column into a spreadsheet which I can then sort by. Not being familar with creating macros, I am looking for any guidance on how to get started. What the macro needs to do is as follows: 1) insert a column into the active spreadsheet as the first column. 2) starting with the active cell in this newly inserted column, populate it with A1,B1,C1,A2,B2,C2,A3,B3,C3, and so on until there is no more data in the second column. I'll also need to know how to save this macro so that I can use it over again. Any help on this is greatly appreciated. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to insert clip art into a cell and have it sortable | Excel Discussion (Misc queries) | |||
Online worksheet and remain sortable? | Excel Discussion (Misc queries) | |||
make worksheets sortable | Excel Worksheet Functions | |||
how to enter sortable dates before 1900 | Excel Discussion (Misc queries) | |||
Sortable list of checkboxes | Excel Discussion (Misc queries) |