Explaination of script, as you will need to amend it:
Assumptions:
(1) Only 10 columns are used, if more or less are required, add or removed lines like (lines 26-35)
strColX = Trim(objWorkSheet...)
(2) The column with the AA/BB/CC/... is column A. If it's any other column, then amend the line (Line 37)
MultiCell = Split(strColA, "/", -1)
(3) The input file is called "input.xls", change line 1
(4) Output is output.csv and you need to delete the file before running the script as the script will append to the output file.
(5) Not much in the way of error checking here!
What it does:
Takes the spreadsheet and read in each cell on the row.
Splits column A delimited by '/'.
Writes a line to a CSV file duplicating the other cells whilst going through each of the codes in col A.
The CSV file can then be loaded into Excel.
Ta-Da!! Hopefully it will show what you want.
Here's the script:
------------------------------------------
strFileNameIn = "input.xls"
StrFileNameOut = "output.csv"
Dim MultiCell
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
strCSVFileIn = objFSO.getAbsolutePathName(".") & "\" & strFileNameIn
strCSVFileOut = objFSO.GetAbsolutePathName(".") & "\" & strFileNameout
If objFSO.FileExists(strCSVFileIn) Then
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = False
objExcel.Workbooks.Open(strCSVFileIn)
intWorkSheets = objExcel.ActiveWorkbook.Sheets.Count
intObjCount = 0
For i = 1 To intWorkSheets
Set objWorkSheet = objExcel.ActiveWorkbook.Worksheets(i)
intRow = 1 'Starting Row
Set objFSO = CreateObject("Scripting.FileSystemObject")
Do until objWorkSheet.Cells(intRow,1).value = ""
strColA = Trim(objWorkSheet.Cells(intRow,1).Value)
strColB = Trim(objWorkSheet.Cells(intRow,2).Value)
strColC = Trim(objWorkSheet.Cells(intRow,3).Value)
strColD = Trim(objWorkSheet.Cells(intRow,4).Value)
strColE = Trim(objWorkSheet.Cells(intRow,5).Value)
strColF = Trim(objWorkSheet.Cells(intRow,6).Value)
strColG = Trim(objWorkSheet.Cells(intRow,7).Value)
strColH = Trim(objWorkSheet.Cells(intRow,8).Value)
strColI = Trim(objWorkSheet.Cells(intRow,9).Value)
strColJ = Trim(objWorkSheet.Cells(intRow,10).Value)
MultiCell = Split(strColA, "/", -1)
For j = LBound(MultiCell) To UBound(MultiCell)
Set objOutStream = objFSO.OpenTextFile(strCSVFileOut,8,True)
Err.Clear
objOutStream.WriteLine(MultiCell(j) & "," & strColB & "," & strColC & "," & strColD & "," & strColE & "," & strColF & "," & strColG & "," & strColH & "," & strColI & "," & strColJ)
Next
Set objOutStream = Nothing
intRow = intRow + 1
intObjCount = intObjCount + 1
Loop
Next
Set objWorkBook = Nothing
Set objWorkSheet = Nothing
objExcel.Quit
WScript.Echo "All Done"
Else
WScript.Echo strCSVFileIn & " does not exist."
End If