Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Tannspose and cycle

Hello
In Excel 2003 I have the sheet1 A2:02 to A832:0632
How can I write this code in a cycle

Range("A2:O2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A3:O3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A19").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A4:O4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A37").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


And so on to A632:0632

Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Tannspose and cycle

Option Explicit
Sub testme()
Dim wks As Worksheet
Dim DestCell As Range
Dim iRow As Long

Set wks = Worksheets("Sheet1") ' or ActiveSheet

Set DestCell = Worksheets("Sheet2").Range("a1")

With wks
For iRow = 2 To 632
' or last used cell in column A
'for irow = 2 to .Cells(.Rows.Count, "A").End(xlUp).Row
.Cells(iRow, "A").Resize(1, .Range("o1").Column).Copy
DestCell.PasteSpecial _
Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
Set DestCell = DestCell.Offset(18, 0)
Next iRow
End With
End Sub

sebastico wrote:

Hello
In Excel 2003 I have the sheet1 A2:02 to A832:0632
How can I write this code in a cycle

Range("A2:O2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A3:O3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A19").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A4:O4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A37").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

And so on to A632:0632

Thank you


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Tannspose and cycle

Dave Excelent

One more question. How can I do If the Renges are different?

Thank you very much indeed

"sebastico" wrote:

Hello
In Excel 2003 I have the sheet1 A2:02 to A832:0632
How can I write this code in a cycle

Range("A2:O2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A3:O3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A19").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A4:O4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A37").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


And so on to A632:0632

Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Tannspose and cycle

Can you be more specifc. The VBA macro code works the same as the wroksheet
when it conmes to copying ranges. whatever you can do (or can't do) on a
worksheet also applies to the macro code.

"sebastico" wrote:

Dave Excelent

One more question. How can I do If the Renges are different?

Thank you very much indeed

"sebastico" wrote:

Hello
In Excel 2003 I have the sheet1 A2:02 to A832:0632
How can I write this code in a cycle

Range("A2:O2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A3:O3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A19").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A4:O4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A37").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


And so on to A632:0632

Thank you

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Tannspose and cycle

It would depend on how they were different--and what range you're asking about
(the copied range or the destination cell????).

If there was no pattern, but the range addresses were always the same, you could
create an array of addresses to copy from -- and even an array of addresses that
you could paste into.



sebastico wrote:

Dave Excelent

One more question. How can I do If the Renges are different?

Thank you very much indeed

"sebastico" wrote:

Hello
In Excel 2003 I have the sheet1 A2:02 to A832:0632
How can I write this code in a cycle

Range("A2:O2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A3:O3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A19").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Range("A4:O4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A37").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


And so on to A632:0632

Thank you


--

Dave Peterson
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
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? Charles A. Wilson Charts and Charting in Excel 1 December 17th 09 03:03 AM
cycle time mmb Charts and Charting in Excel 1 August 21st 08 03:24 PM
cycle thru controls JT Excel Programming 2 September 10th 07 11:48 PM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM
Cycle through all worksheets Patrick Simonds Excel Programming 8 December 26th 05 01:46 PM


All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"