Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Match 1 cell of record and Transpose 2 cells to another sheet.

Excel 2007

In Sheet1 I have data (records) beginning at row 2 thru whatever (say row
318). The number of records can vary. Each record is from column a thru y. I
would like to match column i to either LSTE, LSHG, or Tlibor. When there is a
match take data in column b and k and transpose it to Sheet2 beginning at
cell a1. Column b is text and k is a date. I suppose there could be 318
results but more likely 20 to 30. First match would be data from b in a1,
data from k in a2. Second match would be data from b in b1, data fromk in b2,
etc.

After writing this maybe it would be better to sort on the three items for
column i and copy past (transposing). I just do not know how to do it.

Thank you for looking at my question.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default Match 1 cell of record and Transpose 2 cells to another sheet.

G'day

I use this to extract certain data from one sheet into multiple.

You will have to modify it to suit your data criteria.

Sub Split_Data()

Dim SourceSheet As Worksheet
Dim DestinationSheet As Worksheet
Dim rng As Range

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

'Start of NSW

Sheets("NSW").Select

Set SourceSheet = Sheets("Data")
Set rng = SourceSheet.Range("A8:O" & Rows.Count)
Set DestinationSheet = Sheets("NSW")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="=SYD"

SourceSheet.AutoFilter.Range.Copy
With DestinationSheet.Range("A5")
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
.Select
End With

Range("A4:O50").Select
Selection.Sort Key1:=Range("A4:A50"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

'End of NSW

'Start of QLD

Sheets("Qld").Select

Set SourceSheet = Sheets("Data")
Set rng = SourceSheet.Range("A8:O" & Rows.Count)
Set DestinationSheet = Sheets("Qld")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="=BNE"

SourceSheet.AutoFilter.Range.Copy
With DestinationSheet.Range("A5")
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
.Select
End With

Range("A4:O50").Select
Selection.Sort Key1:=Range("A4:A50"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

'End of QLD

'Start of SA

Sheets("SA").Select

Set SourceSheet = Sheets("Data")
Set rng = SourceSheet.Range("A8:O" & Rows.Count)
Set DestinationSheet = Sheets("SA")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="=ADL"

SourceSheet.AutoFilter.Range.Copy
With DestinationSheet.Range("A5")
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
.Select
End With

Range("A4:O50").Select
Selection.Sort Key1:=Range("A4:A50"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

'End of SA

'Start of Vic

Sheets("Vic").Select

Set SourceSheet = Sheets("Data")
Set rng = SourceSheet.Range("A8:O" & Rows.Count)
Set DestinationSheet = Sheets("Vic")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="=MEL"

SourceSheet.AutoFilter.Range.Copy
With DestinationSheet.Range("A5")
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
.Select
End With

Range("A4:O50").Select
Selection.Sort Key1:=Range("A4:A50"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

'End of Vic

'Start of WA

Sheets("WA").Select

Set SourceSheet = Sheets("Data")
Set rng = SourceSheet.Range("A8:O" & Rows.Count)
Set DestinationSheet = Sheets("WA")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="=PER"

SourceSheet.AutoFilter.Range.Copy
With DestinationSheet.Range("A5")
.PasteSpecial xlPasteValues
Application.CutCopyMode = False
.Select
End With

SourceSheet.AutoFilterMode = False

Range("A4:O50").Select
Selection.Sort Key1:=Range("A4:A50"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

'End of WA

With Application
CalcMode = .Calculation
.Calculation = xlAutomatic
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

HTH
Mark.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Match 1 cell of record and Transpose 2 cells to another sheet.

NoodNutt:

Thank you for your response.
This helps but I was hoping for a loop thru the records and upon match
select appropriate cells and copy this data to other sheet transposed.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I transpose cells associated with a merged cell? rt_at_sea Excel Worksheet Functions 0 April 27th 09 09:53 AM
Move one record to another sheet when I type in a cell Jugglertwo Excel Programming 2 September 11th 08 09:01 PM
Transpose from one sheet to the next and leave out blank cells notso Excel Discussion (Misc queries) 2 January 31st 07 01:42 AM
Transpose rows to columns with varying numbers of lines per record SerPetr Excel Programming 1 January 5th 06 03:38 AM
Transpose rows to columns w/varying numbers of lines per record MG Excel Worksheet Functions 8 November 11th 05 01:01 AM


All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"