1. from your worksheet, press Alt + F11 (open VBE)
2. menu: Insert > Module
3. Write (or just Copy/paste) the below VBA coding into your module
4. press Alt+F11 (Back to Sheet, where your list is in)
5 Press Alt + F8 > Select Macro Name (that is the same name
of the Sub Procedures that you have written in VBA Module)
6. Press RUN button.
The New List is generated in a New Sheet.
Here is the coding
'----- start of coding ----------------
Sub ReOrganizeYourData()
' by siti Vi / villager.girl@gmail.com
' jakarta, indonesia, nov 06, 2009
'-------------------------------------
Dim RefDat As Range
Dim NewSht As Worksheet
Dim NewDat As Range
Dim n As Long, r As Long
Dim nRow As Long, nCol As Integer
Set RefDat = ActiveSheet.UsedRange.Offset(1, 0)
nRow = RefDat.Rows.Count
nCol = RefDat.Columns.Count
Set RefDat = RefDat.Resize(nRow - 1, nCol)
Set RefDat = Application.InputBox( _
Prompt:="Select your Old Data (Excluding the Row Heading)", _
Title:="Sigma Kappa - Re-Org Your Data", Default:=RefDat.Address, Type:=8)
Application.ScreenUpdating = False
Set NewSht = ThisWorkbook.Sheets.Add
Set NewDat = NewSht.Cells(3, 2)
NewSht.Name = "NewData_" & Sheets.Count
NewDat(0, 1) = "Appl_1stName"
NewDat(0, 2) = "Appl_LastName"
NewDat(0, 3) = "Appl_Email"
NewDat(0, 4) = "Parent_1stName"
NewDat(0, 5) = "Parent_LastName"
NewDat(0, 6) = "Parent_Email"
For r = 1 To nRow - 1
If r Mod 2 > 0 Then
n = n + 1
NewDat(n, 0) = n
RefDat(r, 1).Resize(1, nCol).Copy
NewDat(n, 1).PasteSpecial xlPasteValuesAndNumberFormats
RefDat(r + 1, 1).Resize(1, nCol).Copy
NewDat(n, nCol + 1).PasteSpecial xlPasteValuesAndNumberFormats
End If
Next r
Columns("B:H").EntireColumn.AutoFit
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Data Re-Org was Done, ( " & n & " ) Records.", 64, "Sigma Kappa"
Cells(2, 2).Activate
End Sub
'------- end of coding -----