View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_917_] joel[_917_] is offline
external usenet poster
 
Posts: 1
Default Complex Copy/Paste...Then Arrange Results in Columns


The way you posted the data I'm a little confused where the data is
located. See if you can modify this code to do what you want to do.

Sub Movedata()

Set SourceSht = Sheets("sheet1")
Set DestSht = Sheets("sheet2")

FirstRow = 1 'the row where A is located
SecondRow = 4 'the row where AA is located
RowOffset = SecondRow - FirstRow
NewRowCount = 1 'row where data starts in destination sheet

With SourceSht
For RowCount = FirstRow To (SecondRow - 1)
FirstRowHeader = .Range("A" & RowCount)
SecondRowHeader = .Range("A" & (RowCount + RowOffset))
For ColCount = 2 To 4
FirstData = .Cells(RowCount, ColCount)
SecondData = .Cells(RowCount + RowOffset, ColCount)
With DestSht
.Range("A" & NewRowCount) = FirstRowHeader
.Range("B" & NewRowCount) = FirstData
.Range("C" & NewRowCount) = SecondRowHeader
.Range("D" & NewRowCount) = SecondData
NewRowCount = NewRowCount + 1
End With
Next ColCount
Next RowCount
End With

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=197490

http://www.thecodecage.com/forumz