Data manipulation

Billy12excel

New Member
Joined
Nov 17, 2010
Messages
42
Received data file per first sheet1, looking to manipulate
results to = second sheet 1

Excel Workbook
ABCD
1LEVEL of AttainmentNational Office RegionName Upper and LowerRanking Position & Dollar Amount #1
2Quadruple:
3Top LevelNorth District, ILAlbert Einstein#2 - Percent of Increase 6.0%
4Top LevelNorth District, ILAlbert Einstein#2 - Dollar Increase $2,745
5Top LevelNorth District, ILAlbert Einstein#2 New Members 10
6Top LevelNorth District, ILAlbert Einstein#1 Member Renewals 16
7etc,etc,
8
9Triple:
10Mid LevelSouth Valley District, ILTony Tgier#1 NM 105.56%
11Mid LevelSouth Valley District, ILTony Tgier#1 - Percent of Increase 15.6%
12Mid LevelSouth Valley District, ILTony Tgier#1 - Dollar Increase $9,737
13etc,etc,
14
15Double:
16Lower LevelCentral District, ILCarter Mann#2 New Members 6
17Lower LevelCentral District, ILCarter Mann#6 - APD $1,150
18etc,etc,
19
20Single:
21Bottom LevelCentral Distric, ILAlexander Jones#9 - APD $209
Sheet1
Excel Workbook
ABCDEFG
1LEVEL of AttainmentNational Office RegionName Upper and LowerRanking Position & Dollar Amount #1Ranking Position & Dollar Amount #2Ranking Position & Dollar Amount #3Ranking Position & Dollar Amount #4
2Quadruple:
3Top LevelNorth District, ILAlbert Einstein#2 - Percent of Increase 6.0%#2 - Dollar Increase $2,745#2 New Members 10#1 Member Renewals 16
4etc,etc,
5
6Triple:
7Mid LevelSouth Valley District, ILTony Tgier#1 NM 105.56%#1 - Percent of Increase 15.6%#1 - Dollar Increase $9,737
8etc,etc,
9
10Double:
11Lower LevelCentral District, ILCarter Mann#2 New Members 6#6 - APD $1,150
12etc,etc,
13
14Single
15Bottom LevelCentral Distric, ILAlexander Jones#9 - APD $209
16etc,etc,
17
18Ideally all levels saved to separate csv files
Excel 2000 Sheet1
Excel 2000


Ideally all levels saved to separate csv files

Thank you for any help!
 
Double worked, However last row, the Person's name was not there, see below, however the missing person's Ranking Position & Dollar Amount #1, & #2 was in row above but under Column Ranking Position & Dollar Amount #3, & #4 can Ranking Position & Dollar Amount #2, #3, and #4; be removed when not needed as well as that last column of client info not needed. CU445 and WA432 (last Column) from client's original list, might that be the source of the problem? Thank you kindly for your patience with the newer guy</b>
Excel Workbook
ABCDEFGH
1LEVEL of AttainmentNational Office RegionName Upper and LowerRanking Position & Dollar Amount #1Ranking Position & Dollar Amount #2Ranking Position & Dollar Amount #3Ranking Position & Dollar Amount #4
2BeginnerNorth District, ILAlbert Einstein#2 - Percent of Increase 6.0%#2 - Dollar Increase $2,745CU445
32nd intermediateCentral DistrictRom Issac#3 - Percent of Increase 5.4%#3 - Dollar Increase $1,846#4 - Percent of Increase 5.1%#5 - Dollar Increase $2,247WA432
...
Excel 2000
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Double worked, However last row, the Person's name was not there, see below, however the missing person's Ranking Position & Dollar Amount #1, & #2 was in row above but under Column Ranking Position & Dollar Amount #3, & #4 can Ranking Position & Dollar Amount #2, #3, and #4; be removed when not needed as well as that last column of client info not needed. CU445 and WA432 (last Column) from client's original list, might that be the source of the problem? Thank you kindly for your patience with the newer guy</b>
Excel Workbook
ABCDEFGH
1LEVEL of AttainmentNational Office RegionName Upper and LowerRanking Position & Dollar Amount #1Ranking Position & Dollar Amount #2Ranking Position & Dollar Amount #3Ranking Position & Dollar Amount #4
2BeginnerNorth District, ILAlbert Einstein#2 - Percent of Increase 6.0%#2 - Dollar Increase $2,745CU445
32nd intermediateCentral DistrictRom Issac#3 - Percent of Increase 5.4%#3 - Dollar Increase $1,846#4 - Percent of Increase 5.1%#5 - Dollar Increase $2,247WA432
...
Excel 2000

Unclear... Can you post the sample data responsible for the above results?
 
Upvote 0
Domenic, I've reworked and have dbl. checked 1st data sheet, it is the way it was received. (Have Copied only first 30 rows to comply with posting rule) Second sheet would be the hoped for results in xls, then to csv. I Hope this clears everything up. I may have transposed a few things in last few previous posts, I'm sorry, I should have created a complete dummy sheet from the get go.
Excel Workbook
ABCDF
1Quadruple:
2BeginnerNorth District, ILPerson 1#2 - Percent of Increase 6.0%AB561
3BeginnerNorth District, ILPerson 1#2 - Dollar Increase $2,745AB561
4BeginnerNorth District, ILPerson 1#2 New Members 16AB561
5BeginnerNorth District, ILPerson 1#1 Member Renewals 33AB561
6Triple:
7BeginnerCentral District, ILPerson 2#1 ASES 105.56%AB103
8BeginnerCentral District, ILPerson 2#1 - Percent of Increase 11.0%AB103
9BeginnerCentral District, ILPerson 2#1 - Dollar Increase $2,737AB103
102nd intermediateWest, ILPerson 3#1 New Members 10CW677
112nd intermediateWest, ILPerson 3#1 Member Renewals 4CW678
122nd intermediateWest, ILPerson 3#3 XYZ $1,572CW678
13LowerTopSo Central, ILPerson 4#3 - 1,501MS234
14LowerTopSo Central, ILPerson 4#2 - ASES 202.58%MS234
15LowerTopSo Central, ILPerson 4#1 XYZ $3,604MS234
162nd intermediateSo Central, ILPerson 5#1 - VPA $1,502ZW102
172nd intermediateSo Central, ILPerson 5#2 Member Renewals 30ZW102
182nd intermediateSo Central, ILPerson 5#1 XYZ $2,468ZW102
19LowerTopWest Valley, ILPerson 6#1 - VPA $4,250QJ286
20LowerTopWest Valley, ILPerson 6#2 Member Renewals 17QJ286
21LowerTopWest Valley, ILPerson 6#3 XYZ $3,494QJ286
22LowerTopNorth District, ILPerson 7#2 - VPA $2,239RE345
23LowerTopNorth District, ILPerson 7#1 - ASES 317.38%RE345
24LowerTopNorth District, ILPerson 7#4 - XYZ $1,607RE345
252nd intermediateWest Valley, ILPerson 8#2 - VPA $1,982XZ123
262nd intermediateWest Valley, ILPerson 8#2 ASES 124.24%XZ123
272nd intermediateWest Valley, ILPerson 8#4 - XYZ $1,589XZ123
28BeginnerNorth District, ILPerson 9#1 New Members 15BT293
29BeginnerNorth District, ILPerson 9#2 Member Renewals 10BT293
30BeginnerNorth District, ILPerson 9#3 XYZ $1,930BT293
Sheet1
Excel Workbook
ABCDEFG
1Name Upper and LowerNational Office RegionLEVEL of AttainmentRanking Position & Dollar Amount #1Ranking Position & Dollar Amount #2Ranking Position & Dollar Amount #3Ranking Position & Dollar Amount #4
2Quadruple:
3Person 1North District, ILBeginner#2 - Percent of Increase 6.0%#2 - Dollar Increase $2,745#2 New Members 16#1 Member Renewals 33
4Triple:Export to Triple.csv
5Person 2Central District, ILBeginner#1 ASES 105.56%#1 - Percent of Increase 11.0%#1 - Dollar Increase $2,737
6Person 3West, IL2nd intermediate#1 New Members 10#1 Member Renewals 4#3 XYZ $1,572
7Person 4So Central, ILLowerTop#3 - 1,501#2 - ASES 202.58%#1 XYZ $3,604
8Person 5So Central, IL2nd intermediate#1 - VPA $1,502#2 Member Renewals 30#1 XYZ $2,468
9Person 6West Valley, ILLowerTop#1 - VPA $4,250#2 Member Renewals 17#3 XYZ $3,494
10Person 7North District, ILLowerTop#2 - VPA $2,239#1 - ASES 317.38%#4 - XYZ $1,607
11Person 8West Valley, IL2nd intermediate#2 - VPA $1,982#2 ASES 124.24%#4 - XYZ $1,589
12Person 9North District, ILBeginner#1 New Members 15#2 Member Renewals 10#3 XYZ $1,930
13DoubleExport to Doiuble.csv
14Person 10Central DistrictAssociate Level#2 Member Renewals 36#6 - XYZ $1,004
15Person 12North District, IL2nd intermediate#3 New Members 21#7 - XYZ $1,377
16Person 13North District, IL2nd intermediate#3 - VPA $1,736#2 XYZ $2,196
17Person 14West, IL2nd intermediate#3 ASES 123.26%#2 New Members 12
Excel 2000 Results Expected Sheet1
Excel 2000 Thank you, Thank you, for your patience with the newbie.
 
Upvote 0
Try the following instead...

<font face=Calibri><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN><br><br><SPAN style="color:#00007F">Sub</SPAN> CreateCSVFiles()<br><br>    <SPAN style="color:#00007F">Dim</SPAN> Categories <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br>    <SPAN style="color:#00007F">Dim</SPAN> Category <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN><br>    <SPAN style="color:#00007F">Dim</SPAN> strPath <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br>    <SPAN style="color:#00007F">Dim</SPAN> SourceRng <SPAN style="color:#00007F">As</SPAN> Range<br>    <SPAN style="color:#00007F">Dim</SPAN> FoundCell <SPAN style="color:#00007F">As</SPAN> Range<br>    <SPAN style="color:#00007F">Dim</SPAN> Cell <SPAN style="color:#00007F">As</SPAN> Range<br>    <SPAN style="color:#00007F">Dim</SPAN> LastRow <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <SPAN style="color:#00007F">Dim</SPAN> LastColumn <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <SPAN style="color:#00007F">Dim</SPAN> Rw <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <br>    Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br>    <br>    Range(Cells(1, "E"), Cells(1, Columns.Count)).EntireColumn.ClearContents<br>    <br>    Columns("D").Insert<br><br>    LastRow = Cells(Rows.Count, "A").End(xlUp).Row<br>    <br>    <SPAN style="color:#00007F">For</SPAN> i = 2 <SPAN style="color:#00007F">To</SPAN> LastRow<br>        <SPAN style="color:#00007F">If</SPAN> Cells(i, "B").Value <> "" <SPAN style="color:#00007F">Then</SPAN><br>            Cells(i, "D").Value = Cells(i, "A").Value & "#" & Cells(i, "B").Value<br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <SPAN style="color:#00007F">Next</SPAN> i<br>    <br>    <SPAN style="color:#00007F">For</SPAN> i = LastRow <SPAN style="color:#00007F">To</SPAN> 3 <SPAN style="color:#00007F">Step</SPAN> -1<br>        <SPAN style="color:#00007F">If</SPAN> Cells(i, "D").Value <> "" <SPAN style="color:#00007F">Then</SPAN><br>            <SPAN style="color:#00007F">If</SPAN> Cells(i, "D").Value = Cells(i - 1, "D").Value <SPAN style="color:#00007F">Then</SPAN><br>                <SPAN style="color:#00007F">Set</SPAN> SourceRng = Range(Cells(i, "E"), Cells(i, Columns.Count).End(xlToLeft))<br>                Cells(i - 1, "F").Resize(, SourceRng.Columns.Count).Value = SourceRng.Value<br>                Rows(i).Delete<br>            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <SPAN style="color:#00007F">Next</SPAN> i<br>    <br>    Columns("D").Delete<br>    <br>    <SPAN style="color:#007F00">'Change the path to the folder in which you want to save the .csv files</SPAN><br>    strPath = "C:\Users\Domenic\Desktop\Test\"<br>    <br>    <SPAN style="color:#00007F">If</SPAN> Right(strPath, 1) <> "\" <SPAN style="color:#00007F">Then</SPAN> strPath = strPath & "\"<br><br>    Categories = Array("Quadruple", "Triple", "Double", "Single")<br>    <br>    <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> Category <SPAN style="color:#00007F">In</SPAN> Categories<br>        <SPAN style="color:#00007F">With</SPAN> Columns("A")<br>            <SPAN style="color:#00007F">Set</SPAN> FoundCell = .Find(Category, LookIn:=xlValues, lookat:=xlPart, MatchCase:=False)<br>            <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> FoundCell <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>                <SPAN style="color:#00007F">Open</SPAN> strPath & Category & ".csv" <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Output</SPAN> <SPAN style="color:#00007F">As</SPAN> #1<br>                    <SPAN style="color:#00007F">Write</SPAN> #1, "Name Upper and Lower";<br>                    <SPAN style="color:#00007F">Write</SPAN> #1, "National Office Region";<br>                    <SPAN style="color:#00007F">Write</SPAN> #1, "LEVEL of Attainment";<br>                    <SPAN style="color:#00007F">Select</SPAN> <SPAN style="color:#00007F">Case</SPAN> Category<br>                        <SPAN style="color:#00007F">Case</SPAN> "Quadruple"<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #1";<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #2";<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #3";<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #4"<br>                        <SPAN style="color:#00007F">Case</SPAN> "Triple"<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #1";<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #2";<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #3"<br>                        <SPAN style="color:#00007F">Case</SPAN> "Double"<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #1";<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #2"<br>                        <SPAN style="color:#00007F">Case</SPAN> "Single"<br>                            <SPAN style="color:#00007F">Write</SPAN> #1, "Ranking Position & Dollar Amount #1"<br>                    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Select</SPAN><br>                    <SPAN style="color:#00007F">Set</SPAN> Cell = FoundCell.Offset(1, 1)<br>                    <SPAN style="color:#00007F">Do</SPAN> <SPAN style="color:#00007F">While</SPAN> Cell <> ""<br>                        Rw = Cell.Row<br>                        <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "C").Value;<br>                        <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "B").Value;<br>                        <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "A").Value;<br>                        <SPAN style="color:#00007F">Select</SPAN> <SPAN style="color:#00007F">Case</SPAN> Category<br>                            <SPAN style="color:#00007F">Case</SPAN> "Quadruple"<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "D").Value;<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "E").Value;<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "F").Value;<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "G").Value<br>                            <SPAN style="color:#00007F">Case</SPAN> "Triple"<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "D").Value;<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "E").Value;<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "F").Value<br>                            <SPAN style="color:#00007F">Case</SPAN> "Double"<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "D").Value;<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "E").Value<br>                            <SPAN style="color:#00007F">Case</SPAN> "Single"<br>                                <SPAN style="color:#00007F">Write</SPAN> #1, Cells(Rw, "D").Value<br>                        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Select</SPAN><br>                        <SPAN style="color:#00007F">Set</SPAN> Cell = Cell.Offset(1, 0)<br>                    <SPAN style="color:#00007F">Loop</SPAN><br>                <SPAN style="color:#00007F">Close</SPAN> #1<br>            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>    <SPAN style="color:#00007F">Next</SPAN> Category<br>    <br>    Columns.AutoFit<br>    <br>    Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN><br>    <br>    MsgBox "Completed...", vbInformation<br>                    <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0
I wish I knew what I've messed up, I just can't get it to work with the actual client data. I'm Lost!! I've keeping going over and over it. Is it read only then coped to new book? no idea Thank you.
 
Upvote 0
I've condensed The "Data as Received" sheet from client, with all it's formatting. In case, this is where I'm inserting or changing something that is effecting the macro and how it serves up the final output. I'm showing the "Triple" CSV as it would be after the macro has run. There are Multiple rows of data for Quadruple, Triple, Double, and Single. All exported to separate .csv files.
Excel Workbook
ABCDEG
14th Quarter 2010
2QuarterNameStateLevelRanking
3Quadruple Award:
44th Quarter 2010Person 1North District, ILBeginner#2 - Percent of Increase 6.0%
54th Quarter 2010Person 1North District, ILBeginner#2 - Dollar Increase $2,745
64th Quarter 2010Person 1North District, ILBeginner#2 New Members 16
74th Quarter 2010Person 1North District, ILBeginner#1 Member Renewals 33
8
9
10Triple Awards:
114th Quarter 2010Person 2West, IL2nd intermediate#1 ASES 105.56%
124th Quarter 2010Person 2West, IL2nd intermediate#1 - Percent of Increase 11.0%
134th Quarter 2010Person 2West, IL2nd intermediate#1 - Dollar Increase $2,737
144th Quarter 2010Person 3So Central, ILLowerTop#3 - 1,501
154th Quarter 2010Person 3So Central, ILLowerTop#2 - ASES 202.58%
164th Quarter 2010Person 3So Central, ILLowerTop#1 XYZ $3,604
Data as Received
Excel Workbook
ABCDEF
1Name Upper and LowerNational Office RegionLEVEL of AttainmentRanking Position & Dollar Amount #1Ranking Position & Dollar Amount #2Ranking Position & Dollar Amount #3
2Person 1West, IL2nd intermediate#1 ASES 105.56%#1 - Percent of Increase 11.0%#1 - Dollar Increase $2,737
3Person 2So Central, IL2nd intermediate#3 - 1,501#2 - ASES 202.58%#1 XYZ $3,604
Excel 2000 Triple
Excel 2000 Thank you! Thank you,
 
Upvote 0
That's because the format of this last set of data differs from that of the previous one.
 
Upvote 0
Yes, it is different. I think, my deleting Row1 and Col A data, and possible other data changes, I made, to protect client info, are at the route of the problem. Not understanding all of the correct terms and nuances has also been to my disadvantage. On the up side it is forcing me look up the meaning of what I believe are the key terms in this macro and hopefully better understanding said terms. That last post of mine is exactly the way the client provided it, nothing deleted, nothing moved, only in-cell data changed for client privacy. Thank you! Thank you for your patience of a Saint.
 
Upvote 0
Try...

Code:
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]

[color=darkblue]Sub[/color] CreateCSVFiles()

    [color=darkblue]Dim[/color] Categories [color=darkblue]As[/color] [color=darkblue]Variant[/color]
    [color=darkblue]Dim[/color] Category [color=darkblue]As[/color] [color=darkblue]Variant[/color]
    [color=darkblue]Dim[/color] strPath [color=darkblue]As[/color] [color=darkblue]String[/color]
    [color=darkblue]Dim[/color] SourceRng [color=darkblue]As[/color] Range
    [color=darkblue]Dim[/color] FoundCell [color=darkblue]As[/color] Range
    [color=darkblue]Dim[/color] Cell [color=darkblue]As[/color] Range
    [color=darkblue]Dim[/color] LastRow [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] LastColumn [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] i [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] Rw [color=darkblue]As[/color] [color=darkblue]Long[/color]
    
    Application.ScreenUpdating = [color=darkblue]False[/color]
    
    Range(Cells(1, "F"), Cells(1, Columns.Count)).EntireColumn.ClearContents
    
    Columns("E").Insert

    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    [color=darkblue]For[/color] i = 4 [color=darkblue]To[/color] LastRow
        [color=darkblue]If[/color] Cells(i, "C").Value <> "" [color=darkblue]Then[/color]
            Cells(i, "E").Value = Cells(i, "A").Value & "#" & Cells(i, "B").Value & "#" & Cells(i, "C").Value & "#" & Cells(i, "D").Value
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]Next[/color] i
    
    [color=darkblue]For[/color] i = LastRow [color=darkblue]To[/color] 4 [color=darkblue]Step[/color] -1
        [color=darkblue]If[/color] Cells(i, "E").Value <> "" [color=darkblue]Then[/color]
            [color=darkblue]If[/color] Cells(i, "E").Value = Cells(i - 1, "E").Value [color=darkblue]Then[/color]
                [color=darkblue]Set[/color] SourceRng = Range(Cells(i, "F"), Cells(i, Columns.Count).End(xlToLeft))
                Cells(i - 1, "G").Resize(, SourceRng.Columns.Count).Value = SourceRng.Value
                Rows(i).Delete
            [color=darkblue]End[/color] [color=darkblue]If[/color]
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]Next[/color] i
    
    Columns("E").Delete
    
    [color=green]'Change the path accordingly[/color]
    strPath = "C:\Users\Domenic\Desktop\Test\"
    
    [color=darkblue]If[/color] Right(strPath, 1) <> "\" [color=darkblue]Then[/color] strPath = strPath & "\"

    Categories = Array("Quadruple", "Triple", "Double", "Single")
    
    [color=darkblue]For[/color] [color=darkblue]Each[/color] Category [color=darkblue]In[/color] Categories
        [color=darkblue]With[/color] Columns("A")
            [color=darkblue]Set[/color] FoundCell = .Find(Category, LookIn:=xlValues, lookat:=xlPart, MatchCase:=False)
            [color=darkblue]If[/color] [color=darkblue]Not[/color] FoundCell [color=darkblue]Is[/color] [color=darkblue]Nothing[/color] [color=darkblue]Then[/color]
                [color=darkblue]Open[/color] strPath & Category & ".csv" [color=darkblue]For[/color] [color=darkblue]Output[/color] [color=darkblue]As[/color] #1
                    [color=darkblue]Write[/color] #1, "Name Upper and Lower";
                    [color=darkblue]Write[/color] #1, "National Office Region";
                    [color=darkblue]Write[/color] #1, "LEVEL of Attainment";
                    [color=darkblue]Select[/color] [color=darkblue]Case[/color] Category
                        [color=darkblue]Case[/color] "Quadruple"
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #1";
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #2";
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #3";
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #4"
                        [color=darkblue]Case[/color] "Triple"
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #1";
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #2";
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #3"
                        [color=darkblue]Case[/color] "Double"
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #1";
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #2"
                        [color=darkblue]Case[/color] "Single"
                            [color=darkblue]Write[/color] #1, "Ranking Position & Dollar Amount #1"
                    [color=darkblue]End[/color] [color=darkblue]Select[/color]
                    [color=darkblue]Set[/color] Cell = FoundCell.Offset(1, 1)
                    [color=darkblue]Do[/color] [color=darkblue]While[/color] Cell <> ""
                        Rw = Cell.Row
                        [color=darkblue]Write[/color] #1, Cells(Rw, "B").Value;
                        [color=darkblue]Write[/color] #1, Cells(Rw, "C").Value;
                        [color=darkblue]Write[/color] #1, Cells(Rw, "D").Value;
                        [color=darkblue]Select[/color] [color=darkblue]Case[/color] Category
                            [color=darkblue]Case[/color] "Quadruple"
                                [color=darkblue]Write[/color] #1, Cells(Rw, "E").Value;
                                [color=darkblue]Write[/color] #1, Cells(Rw, "F").Value;
                                [color=darkblue]Write[/color] #1, Cells(Rw, "G").Value;
                                [color=darkblue]Write[/color] #1, Cells(Rw, "H").Value
                            [color=darkblue]Case[/color] "Triple"
                                [color=darkblue]Write[/color] #1, Cells(Rw, "E").Value;
                                [color=darkblue]Write[/color] #1, Cells(Rw, "F").Value;
                                [color=darkblue]Write[/color] #1, Cells(Rw, "G").Value
                            [color=darkblue]Case[/color] "Double"
                                [color=darkblue]Write[/color] #1, Cells(Rw, "E").Value;
                                [color=darkblue]Write[/color] #1, Cells(Rw, "F").Value
                            [color=darkblue]Case[/color] "Single"
                                [color=darkblue]Write[/color] #1, Cells(Rw, "E").Value
                        [color=darkblue]End[/color] [color=darkblue]Select[/color]
                        [color=darkblue]Set[/color] Cell = Cell.Offset(1, 0)
                    [color=darkblue]Loop[/color]
                [color=darkblue]Close[/color] #1
            [color=darkblue]End[/color] [color=darkblue]If[/color]
        [color=darkblue]End[/color] [color=darkblue]With[/color]
    [color=darkblue]Next[/color] Category
    
    Columns.AutoFit
    
    Application.ScreenUpdating = [color=darkblue]True[/color]
    
    MsgBox "Completed...", vbInformation
                    
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]
 
Upvote 0
Microsoft Visual Basic window, with Red X and 400 error. I keep trying, Does a read only file ( it is ), then I save as new name effect it? Thank you,
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,820
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top