PC Review


Reply
Thread Tools Rate Thread

Data sorting to a new sheet

 
 
Novice Lee
Guest
Posts: n/a
 
      25th Jul 2008
I'm not even sure this can be done. What am trying to do is sort data from
Sheet 1 and place the sorted data on sheet 2 & 3.
Here is what the data would look like:

1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
2 INIT_SD 5.5.001
3 NAC_110 V2-01
A4-03
4 INIT_SD 5.5.021
5 INIT_SD 5.6.001
6 NAC_110 V3-01
A1-23
7 NAC_110 V1-01
A1-01

What I need is all Rows with something in Address1 column goes to sheet1 (in
order) and all Rows with something in column Strobe_circuit_info goes to
sheet 3(in order). I also need them to be grouped on the other sheet (2 & 3).
ex.
3 NAC_110 V1-01
A1-01
30 NAC_110 V2-01
A4-03
57 NAC_110 V3-01
A1-23

so if the if there is a device V1-02 it would go in row 4 and so on, same
for sheet 2

Is this possible or am i really reaching

Thanks for your input
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      25th Jul 2008
This doesn't sound too difficult. I just confused by the sheet numbers in
your description

1) what sheet is th original data located on?
2) I think you incorrectly said the data goes on sheet 1 instead of sheet 2.
3) You said to put the data inorder on sheet 1, but then said to sort data.
Which is correct?
4) Are yuor columns A toc D?

"Novice Lee" wrote:

> I'm not even sure this can be done. What am trying to do is sort data from
> Sheet 1 and place the sorted data on sheet 2 & 3.
> Here is what the data would look like:
>
> 1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
> 2 INIT_SD 5.5.001
> 3 NAC_110 V2-01
> A4-03
> 4 INIT_SD 5.5.021
> 5 INIT_SD 5.6.001
> 6 NAC_110 V3-01
> A1-23
> 7 NAC_110 V1-01
> A1-01
>
> What I need is all Rows with something in Address1 column goes to sheet1 (in
> order) and all Rows with something in column Strobe_circuit_info goes to
> sheet 3(in order). I also need them to be grouped on the other sheet (2 & 3).
> ex.
> 3 NAC_110 V1-01
> A1-01
> 30 NAC_110 V2-01
> A4-03
> 57 NAC_110 V3-01
> A1-23
>
> so if the if there is a device V1-02 it would go in row 4 and so on, same
> for sheet 2
>
> Is this possible or am i really reaching
>
> Thanks for your input

 
Reply With Quote
 
Novice Lee
Guest
Posts: n/a
 
      25th Jul 2008
Morning

In regards to your questions Joel:
1)the original data is imported to sheet 1
2)you are correct it should be sheet 2
3)both, the data needs to be in order on the sheets 2 & 3 but it also needs
to be put in groups.
4) there are more than four columns, but column b and column c are the main
sorting column. Every Init device will have something in the Address1 column
and every Nac device will have something in the Strobe_Circuit_Info Column.

A B C
D
1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
2 INIT_SD 5.5.001
3 NAC_110 V2-01 A4-03
4 INIT_SD 5.5.021
5 INIT_SD 5.6.001
6 NAC_110 V3-01 A1-23
7 NAC_110 V1-01 A1-01


this is what it was suppose to look like

Thanks

"Joel" wrote:

> This doesn't sound too difficult. I just confused by the sheet numbers in
> your description
>
> 1) what sheet is th original data located on?
> 2) I think you incorrectly said the data goes on sheet 1 instead of sheet 2.
> 3) You said to put the data inorder on sheet 1, but then said to sort data.
> Which is correct?
> 4) Are yuor columns A toc D?
>
> "Novice Lee" wrote:
>
> > I'm not even sure this can be done. What am trying to do is sort data from
> > Sheet 1 and place the sorted data on sheet 2 & 3.
> > Here is what the data would look like:
> >
> > 1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
> > 2 INIT_SD 5.5.001
> > 3 NAC_110 V2-01
> > A4-03
> > 4 INIT_SD 5.5.021
> > 5 INIT_SD 5.6.001
> > 6 NAC_110 V3-01
> > A1-23
> > 7 NAC_110 V1-01
> > A1-01
> >
> > What I need is all Rows with something in Address1 column goes to sheet1 (in
> > order) and all Rows with something in column Strobe_circuit_info goes to
> > sheet 3(in order). I also need them to be grouped on the other sheet (2 & 3).
> > ex.
> > 3 NAC_110 V1-01
> > A1-01
> > 30 NAC_110 V2-01
> > A4-03
> > 57 NAC_110 V3-01
> > A1-23
> >
> > so if the if there is a device V1-02 it would go in row 4 and so on, same
> > for sheet 2
> >
> > Is this possible or am i really reaching
> >
> > Thanks for your input

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      25th Jul 2008
Sub MoveData()

'clear sheet 2 and copy header row
With Sheets(2)
Cells.ClearContents
Sheets(1).Rows(1).Copy Destination:=.Rows(1)
End With

'clear sheet 3 and copy header row
With Sheets(3)
Cells.ClearContents
Sheets(1).Rows(1).Copy Destination:=.Rows(1)
End With

Sh1RowCount = 2
Sh2RowCount = 2
Sh3RowCount = 2

With Sheets(1)
Do While .Range("A" & Sh1RowCount) <> ""
If .Range("B" & Sh1RowCount) <> "" Then
.Row(Sh1RowCount).Copy _
Destination:=Sheets(2).Row(Sh2RowCount)
Sh2RowCount = Sh2RowCount + 1
End If
If .Range("C" & Sh1RowCount) <> "" Then
.Row(Sh1RowCount).Copy _
Destination:=Sheets(3).Row(Sh3RowCount)
Sh3RowCount = Sh3RowCount + 1
End If
Sh1RowCount = Sh1RowCount + 1
Loop
End With

'Sort sheet 3
With Sheets(3)

LastRow = .Range("A" & Rows.Count).End(xlUp).Row
Set SortRange = .Rows("2:" & LastRow)
SortRange.Sort _
Key1:=Range("A2"), _
Order1:=xlAscending, _
Key2:=Range("C2"), _
Order2:=xlAscending, _
Header:=xlNo
End With
End Sub


"Novice Lee" wrote:

> Morning
>
> In regards to your questions Joel:
> 1)the original data is imported to sheet 1
> 2)you are correct it should be sheet 2
> 3)both, the data needs to be in order on the sheets 2 & 3 but it also needs
> to be put in groups.
> 4) there are more than four columns, but column b and column c are the main
> sorting column. Every Init device will have something in the Address1 column
> and every Nac device will have something in the Strobe_Circuit_Info Column.
>
> A B C
> D
> 1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
> 2 INIT_SD 5.5.001
> 3 NAC_110 V2-01 A4-03
> 4 INIT_SD 5.5.021
> 5 INIT_SD 5.6.001
> 6 NAC_110 V3-01 A1-23
> 7 NAC_110 V1-01 A1-01
>
>
> this is what it was suppose to look like
>
> Thanks
>
> "Joel" wrote:
>
> > This doesn't sound too difficult. I just confused by the sheet numbers in
> > your description
> >
> > 1) what sheet is th original data located on?
> > 2) I think you incorrectly said the data goes on sheet 1 instead of sheet 2.
> > 3) You said to put the data inorder on sheet 1, but then said to sort data.
> > Which is correct?
> > 4) Are yuor columns A toc D?
> >
> > "Novice Lee" wrote:
> >
> > > I'm not even sure this can be done. What am trying to do is sort data from
> > > Sheet 1 and place the sorted data on sheet 2 & 3.
> > > Here is what the data would look like:
> > >
> > > 1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
> > > 2 INIT_SD 5.5.001
> > > 3 NAC_110 V2-01
> > > A4-03
> > > 4 INIT_SD 5.5.021
> > > 5 INIT_SD 5.6.001
> > > 6 NAC_110 V3-01
> > > A1-23
> > > 7 NAC_110 V1-01
> > > A1-01
> > >
> > > What I need is all Rows with something in Address1 column goes to sheet1 (in
> > > order) and all Rows with something in column Strobe_circuit_info goes to
> > > sheet 3(in order). I also need them to be grouped on the other sheet (2 & 3).
> > > ex.
> > > 3 NAC_110 V1-01
> > > A1-01
> > > 30 NAC_110 V2-01
> > > A4-03
> > > 57 NAC_110 V3-01
> > > A1-23
> > >
> > > so if the if there is a device V1-02 it would go in row 4 and so on, same
> > > for sheet 2
> > >
> > > Is this possible or am i really reaching
> > >
> > > Thanks for your input

 
Reply With Quote
 
Novice Lee
Guest
Posts: n/a
 
      25th Jul 2008
If I change the Sheet name (sheet 2) to ALD Would I change Sheets(2) to ALD?

"Joel" wrote:

> Sub MoveData()
>
> 'clear sheet 2 and copy header row
> With Sheets(2)
> Cells.ClearContents
> Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> End With
>
> 'clear sheet 3 and copy header row
> With Sheets(3)
> Cells.ClearContents
> Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> End With
>
> Sh1RowCount = 2
> Sh2RowCount = 2
> Sh3RowCount = 2
>
> With Sheets(1)
> Do While .Range("A" & Sh1RowCount) <> ""
> If .Range("B" & Sh1RowCount) <> "" Then
> .Row(Sh1RowCount).Copy _
> Destination:=Sheets(2).Row(Sh2RowCount)
> Sh2RowCount = Sh2RowCount + 1
> End If
> If .Range("C" & Sh1RowCount) <> "" Then
> .Row(Sh1RowCount).Copy _
> Destination:=Sheets(3).Row(Sh3RowCount)
> Sh3RowCount = Sh3RowCount + 1
> End If
> Sh1RowCount = Sh1RowCount + 1
> Loop
> End With
>
> 'Sort sheet 3
> With Sheets(3)
>
> LastRow = .Range("A" & Rows.Count).End(xlUp).Row
> Set SortRange = .Rows("2:" & LastRow)
> SortRange.Sort _
> Key1:=Range("A2"), _
> Order1:=xlAscending, _
> Key2:=Range("C2"), _
> Order2:=xlAscending, _
> Header:=xlNo
> End With
> End Sub
>
>


 
Reply With Quote
 
Novice Lee
Guest
Posts: n/a
 
      25th Jul 2008
I tried it on my break. cleared my sheet 1 and then crashed I did the debug
button and it highlighted this section

With Sheets(3)

LastRow = .Range("A" & Rows.Count).End(xlUp).Row
Set SortRange = .Rows("2:" & LastRow)
SortRange.Sort _
Key1:=Range("A2"), _
Order1:=xlAscending, _
Key2:=Range("C2"), _
Order2:=xlAscending, _
Header:=xlNo
End With


"Joel" wrote:

> Sub MoveData()
>
> 'clear sheet 2 and copy header row
> With Sheets(2)
> Cells.ClearContents
> Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> End With
>
> 'clear sheet 3 and copy header row
> With Sheets(3)
> Cells.ClearContents
> Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> End With
>
> Sh1RowCount = 2
> Sh2RowCount = 2
> Sh3RowCount = 2
>
> With Sheets(1)
> Do While .Range("A" & Sh1RowCount) <> ""
> If .Range("B" & Sh1RowCount) <> "" Then
> .Row(Sh1RowCount).Copy _
> Destination:=Sheets(2).Row(Sh2RowCount)
> Sh2RowCount = Sh2RowCount + 1
> End If
> If .Range("C" & Sh1RowCount) <> "" Then
> .Row(Sh1RowCount).Copy _
> Destination:=Sheets(3).Row(Sh3RowCount)
> Sh3RowCount = Sh3RowCount + 1
> End If
> Sh1RowCount = Sh1RowCount + 1
> Loop
> End With
>
> 'Sort sheet 3
> With Sheets(3)
>
> LastRow = .Range("A" & Rows.Count).End(xlUp).Row
> Set SortRange = .Rows("2:" & LastRow)
> SortRange.Sort _
> Key1:=Range("A2"), _
> Order1:=xlAscending, _
> Key2:=Range("C2"), _
> Order2:=xlAscending, _
> Header:=xlNo
> End With
> End Sub
>
>
> "Novice Lee" wrote:
>
> > Morning
> >
> > In regards to your questions Joel:
> > 1)the original data is imported to sheet 1
> > 2)you are correct it should be sheet 2
> > 3)both, the data needs to be in order on the sheets 2 & 3 but it also needs
> > to be put in groups.
> > 4) there are more than four columns, but column b and column c are the main
> > sorting column. Every Init device will have something in the Address1 column
> > and every Nac device will have something in the Strobe_Circuit_Info Column.
> >
> > A B C
> > D
> > 1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
> > 2 INIT_SD 5.5.001
> > 3 NAC_110 V2-01 A4-03
> > 4 INIT_SD 5.5.021
> > 5 INIT_SD 5.6.001
> > 6 NAC_110 V3-01 A1-23
> > 7 NAC_110 V1-01 A1-01
> >
> >
> > this is what it was suppose to look like
> >
> > Thanks
> >
> > "Joel" wrote:
> >
> > > This doesn't sound too difficult. I just confused by the sheet numbers in
> > > your description
> > >
> > > 1) what sheet is th original data located on?
> > > 2) I think you incorrectly said the data goes on sheet 1 instead of sheet 2.
> > > 3) You said to put the data inorder on sheet 1, but then said to sort data.
> > > Which is correct?
> > > 4) Are yuor columns A toc D?
> > >
> > > "Novice Lee" wrote:
> > >
> > > > I'm not even sure this can be done. What am trying to do is sort data from
> > > > Sheet 1 and place the sorted data on sheet 2 & 3.
> > > > Here is what the data would look like:
> > > >
> > > > 1 BLOCKNAME ADDRESS1 STROBE_CIRCUIT_INFO SPEAKER_CIRCUIT_INFO
> > > > 2 INIT_SD 5.5.001
> > > > 3 NAC_110 V2-01
> > > > A4-03
> > > > 4 INIT_SD 5.5.021
> > > > 5 INIT_SD 5.6.001
> > > > 6 NAC_110 V3-01
> > > > A1-23
> > > > 7 NAC_110 V1-01
> > > > A1-01
> > > >
> > > > What I need is all Rows with something in Address1 column goes to sheet1 (in
> > > > order) and all Rows with something in column Strobe_circuit_info goes to
> > > > sheet 3(in order). I also need them to be grouped on the other sheet (2 & 3).
> > > > ex.
> > > > 3 NAC_110 V1-01
> > > > A1-01
> > > > 30 NAC_110 V2-01
> > > > A4-03
> > > > 57 NAC_110 V3-01
> > > > A1-23
> > > >
> > > > so if the if there is a device V1-02 it would go in row 4 and so on, same
> > > > for sheet 2
> > > >
> > > > Is this possible or am i really reaching
> > > >
> > > > Thanks for your input

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      25th Jul 2008
the sheet names can be iether of the following

Sheets(1) - the first sheet in order in the workbook. the 2nd sheet would
be sheets(2)

Sheets("Sheet1") - the sheet name in double quotes. can be "ALD"

sht = "ALD" - using a varible with the sheet name in double quotes.

sheets(sht) - no double quote



No sure why it crashed unless it has to do something with you changing sheet
names. You may not have any data in column A in the first sheet.


"Novice Lee" wrote:

> If I change the Sheet name (sheet 2) to ALD Would I change Sheets(2) to ALD?
>
> "Joel" wrote:
>
> > Sub MoveData()
> >
> > 'clear sheet 2 and copy header row
> > With Sheets(2)
> > Cells.ClearContents
> > Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> > End With
> >
> > 'clear sheet 3 and copy header row
> > With Sheets(3)
> > Cells.ClearContents
> > Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> > End With
> >
> > Sh1RowCount = 2
> > Sh2RowCount = 2
> > Sh3RowCount = 2
> >
> > With Sheets(1)
> > Do While .Range("A" & Sh1RowCount) <> ""
> > If .Range("B" & Sh1RowCount) <> "" Then
> > .Row(Sh1RowCount).Copy _
> > Destination:=Sheets(2).Row(Sh2RowCount)
> > Sh2RowCount = Sh2RowCount + 1
> > End If
> > If .Range("C" & Sh1RowCount) <> "" Then
> > .Row(Sh1RowCount).Copy _
> > Destination:=Sheets(3).Row(Sh3RowCount)
> > Sh3RowCount = Sh3RowCount + 1
> > End If
> > Sh1RowCount = Sh1RowCount + 1
> > Loop
> > End With
> >
> > 'Sort sheet 3
> > With Sheets(3)
> >
> > LastRow = .Range("A" & Rows.Count).End(xlUp).Row
> > Set SortRange = .Rows("2:" & LastRow)
> > SortRange.Sort _
> > Key1:=Range("A2"), _
> > Order1:=xlAscending, _
> > Key2:=Range("C2"), _
> > Order2:=xlAscending, _
> > Header:=xlNo
> > End With
> > End Sub
> >
> >

>

 
Reply With Quote
 
Novice Lee
Guest
Posts: n/a
 
      25th Jul 2008
Thanks for your help I will fiddle around with it this week end

"Joel" wrote:

> the sheet names can be iether of the following
>
> Sheets(1) - the first sheet in order in the workbook. the 2nd sheet would
> be sheets(2)
>
> Sheets("Sheet1") - the sheet name in double quotes. can be "ALD"
>
> sht = "ALD" - using a varible with the sheet name in double quotes.
>
> sheets(sht) - no double quote
>
>
>
> No sure why it crashed unless it has to do something with you changing sheet
> names. You may not have any data in column A in the first sheet.
>
>
> "Novice Lee" wrote:
>
> > If I change the Sheet name (sheet 2) to ALD Would I change Sheets(2) to ALD?
> >
> > "Joel" wrote:
> >
> > > Sub MoveData()
> > >
> > > 'clear sheet 2 and copy header row
> > > With Sheets(2)
> > > Cells.ClearContents
> > > Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> > > End With
> > >
> > > 'clear sheet 3 and copy header row
> > > With Sheets(3)
> > > Cells.ClearContents
> > > Sheets(1).Rows(1).Copy Destination:=.Rows(1)
> > > End With
> > >
> > > Sh1RowCount = 2
> > > Sh2RowCount = 2
> > > Sh3RowCount = 2
> > >
> > > With Sheets(1)
> > > Do While .Range("A" & Sh1RowCount) <> ""
> > > If .Range("B" & Sh1RowCount) <> "" Then
> > > .Row(Sh1RowCount).Copy _
> > > Destination:=Sheets(2).Row(Sh2RowCount)
> > > Sh2RowCount = Sh2RowCount + 1
> > > End If
> > > If .Range("C" & Sh1RowCount) <> "" Then
> > > .Row(Sh1RowCount).Copy _
> > > Destination:=Sheets(3).Row(Sh3RowCount)
> > > Sh3RowCount = Sh3RowCount + 1
> > > End If
> > > Sh1RowCount = Sh1RowCount + 1
> > > Loop
> > > End With
> > >
> > > 'Sort sheet 3
> > > With Sheets(3)
> > >
> > > LastRow = .Range("A" & Rows.Count).End(xlUp).Row
> > > Set SortRange = .Rows("2:" & LastRow)
> > > SortRange.Sort _
> > > Key1:=Range("A2"), _
> > > Order1:=xlAscending, _
> > > Key2:=Range("C2"), _
> > > Order2:=xlAscending, _
> > > Header:=xlNo
> > > End With
> > > End Sub
> > >
> > >

> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting data in new sheet. sam Microsoft Excel Worksheet Functions 3 31st Jul 2009 02:21 PM
Sorting data in one sheet Gwen Microsoft Excel Worksheet Functions 0 20th May 2009 04:06 PM
sorting data from one sheet to another rldjda Microsoft Excel Worksheet Functions 4 22nd Mar 2008 08:01 PM
SORTING DATA TO ANOTHER SHEET =?Utf-8?B?Y2l0eWZj?= Microsoft Excel Worksheet Functions 0 11th Jan 2006 11:40 PM
SORTING DATA TO ANOTHER SHEET =?Utf-8?B?Y2l0eWZj?= Microsoft Excel Worksheet Functions 0 11th Jan 2006 11:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:24 AM.