Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 82
Default Macro to traspose cell values

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.-
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro to traspose cell values

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

"Emece" wrote:

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.-

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
traspose data with formulas Darshan Excel Worksheet Functions 3 September 5th 07 11:25 PM
Macro to double values in a cell MS Excel Worksheet Functions 9 May 13th 07 03:20 AM
Retrieving Values from Cell with Macro Anift Setting up and Configuration of Excel 4 November 21st 06 05:22 AM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
traspose a row by links Stan Altshuller Excel Worksheet Functions 1 January 5th 05 05:43 PM


All times are GMT +1. The time now is 10:48 PM.

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"