Macro to traspose cell values

E

Emece

I need a Macro to traspose values from a column in Sheet 1 to a row in Sheet
2. The column has 100 rows, I need to traspose from seven to seven. I did the
part of the macro that traspose the values, but I don't know how to put this
in a For or While Structure so as to count seven cells.

This is what I did:
Range("A2:A8").Select
Selection.Copy
Sheets("Sheet3").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Thanks in advance

Regards
Emece.-
 
F

FSt1

hi
if i understand you, you have a column 100 values long and want to transpose
it to to rows on sheet 2 in groups of 7.
try this. let me know if it worked for you.
Sub trans()
Dim r As Range
Dim rd As Range
Dim ro As Range
Dim rod As Range
Dim rm As Range
Dim lr As Long
Dim c As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Set r = Range("A2")
Set ro = Sheets("sheet2").Range("b3")
Set rm = Range("A2:A" & lr)
c = 1
For Each cell In rm
Set rd = r.Offset(1, 0)
Set rod = ro.Offset(0, 1)
ro.Value = r.Value
c = c + 1
Set r = rd
If c < 8 Then
Set ro = rod
Else
Set ro = ro.Offset(1, -6)
c = 1
End If
Next cell
End Sub

works in xp.
regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top