View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Need Major Help on the Macro

Try this. I had to make some assumptions so come back if it doesn't work.

Option Explicit
Sub Transpose()
Dim aWS As Worksheet
Dim myRow As Long
Dim myDelta
Dim myRange As Range
Dim bRow As Long
Dim i As Long

bRow = 26

Set aWS = ActiveSheet
For myRow = 26 To 1000
myDelta = aWS.Cells(myRow, "Q").Value2
If IsNumeric(myDelta) And myDelta 0 Then
Set myRange = aWS.Cells(myRow, "V").Resize(1, myDelta)
Debug.Print myRange.Address
'Need to tranpose this
For i = bRow To bRow + myRange.Count
aWS.Cells(i, "AZ").Value = myRange.Cells(i - bRow + 1).Value
Next i
bRow = bRow + 2
End If

Next myRow

End Sub

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"bioyyy" wrote:

Hello:

I need your help desperately. Transpose the columns into rows with a
condition. For example,

Q R S T U V
X Y Z AA AB
Row 26 6 A1 B1 C1 D1 1:1 1:2
12:2
Row 27 5 B2 C1 -- -- --- --

So, here are the steps what I would like to you help me,

(1) if row 26, col Q has 6, copy 6 columns from V to AB (ie. # column copy =
number enter in row 26 col Q.
(2) Tranpose and put in col AZ, row 26 (starting on row 26)
(3) Skip 2 rows,
(4) then repeat for row 27. So, if row 27, col Q has 5, copy 5 columns from
V to AA. Tranpose, skip 2 rows and repeat that up to row 1000.

Your help is greatly appreciated.