View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_813_] joel[_813_] is offline
external usenet poster
 
Posts: 1
Default Manipulating Table data


I like moving this type data from one worksheet to another worksheet
like the code below. The variable names should explain what the code
does.


Sub MakeRunning()

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

DestRowCount = 1
With Srcsht
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column

For ColCount = 2 To LastCol
ColHeader = .Cells(1, ColCount)
For RowCount = 2 To LastRow
RowHeader = .Range("A" & RowCount)
Data = .Cells(RowCount, ColCount)

With DestSht
Range("A" & DestRowCount) = RowHeader
Range("B" & DestRowCount) = ColHeader
Range("C" & DestRowCount) = Data
DestRowCount = DestRowCount + 1
End With

Next RowCount

Next ColCount

End With

End Sub


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

http://www.thecodecage.com/forumz/chat.php