Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below assumes the orignal worksheet is c all Summary. change as
required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below assumes the orignal worksheet is c all Summary. change as
required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below assumes the orignal worksheet is c all Summary. change as
required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below assumes the orignal worksheet is c all Summary. change as
required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below assumes the orignal worksheet is c all Summary. change as
required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below assumes the orignal worksheet is c all Summary. change as
required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Joel one small change can I get Heading in all the country pages also
TIA "Joel" wrote: The code below assumes the orignal worksheet is c all Summary. change as required. Sub CreateSheets() With Sheets("Summary") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row .Rows("2:" & Lastrow).Sort _ Key1:=.Range("A2"), _ Order1:=xlAscending, _ Header:=xlNo RowCount = 2 Start = RowCount Do While .Range("A" & RowCount) < "" If .Range("A" & RowCount) < .Range("A" & (RowCount + 1)) Then 'Create New sheet Set NewSht = Sheets.Add(after:=Sheets(Sheets.Count)) Country = .Range("A" & RowCount) NewSht.Name = Country 'Make Header Row .Range("A1") = "Site" .Range("B1") = "CaseType" .Range("C1") = "Priority" .Range("D1") = "Status" .Range("E1") = "CaseID" 'copy rows of data .Range("A" & Start & ":A" & RowCount).Copy _ Destination:=NewSht.Range("A2") .Range("G" & Start & ":G" & RowCount).Copy _ Destination:=NewSht.Range("B2") .Range("C" & Start & ":C" & RowCount).Copy _ Destination:=NewSht.Range("C2") .Range("F" & Start & ":F" & RowCount).Copy _ Destination:=NewSht.Range("D2") .Range("B" & Start & ":B" & RowCount).Copy _ Destination:=NewSht.Range("E2") NewSht.Columns("A:E").AutoFit Start = RowCount + 1 End If RowCount = RowCount + 1 Loop End With End Sub "kiran" wrote: Hi All, I have a report as follows Site Case ID+ Priority* Arrival Time Response Time Status* Case Type* Pakistan AAHD00000376417 Medium 01/01/2009 12:45 01/01/2009 12:48 Closed Incident Malaysia AAHD00000376584 Medium 02/01/2009 9:29 02/01/2009 9:32 WIP Incident Indonesia AAHD00000376695 Low 02/01/2009 13:21 02/01/2009 14:08 Closed Request India AAHD00000377262 Medium 05/01/2009 10:00 05/01/2009 10:03 Resolved Incident Korea AAHD00000377363 Medium 05/01/2009 11:32 05/01/2009 12:19 Closed Question India AAHD00000377630 Medium 05/01/2009 15:19 05/01/2009 15:20 Closed Incident India AAHD00000377669 Medium 05/01/2009 16:34 05/01/2009 16:35 Resolved Incident China AAHD00000377681 Medium 05/01/2009 17:25 05/01/2009 17:26 Closed Question China AAHD00000378016 Medium 06/01/2009 9:54 06/01/2009 9:58 Closed Incident Philippines AAHD00000378024 Medium 06/01/2009 10:01 06/01/2009 10:01 Closed Incident Thailand AAHD00000378058 Medium 06/01/2009 10:30 06/01/2009 10:31 WIP Incident I want country wise output in diffrent sheets Out put should look as follows:- Site CaseType Priority Status CaseID India Incident Medium Closed AAHD00000377630 India Incident Medium Resolved AAHD00000377669 like wise I want in all the sheets for each country wise. TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro required please | Excel Discussion (Misc queries) | |||
Macro Help Required | Excel Discussion (Misc queries) | |||
macro required.. | Excel Programming | |||
Pilgrim needs help: Effecting keystroks required by a macro nested within a macro. | Excel Programming | |||
Macro help required! | Excel Programming |