Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? | Charts and Charting in Excel | |||
cycle time | Charts and Charting in Excel | |||
cycle thru controls | Excel Programming | |||
How do I keep result from 1 iteration cycle to use in next cycle? | Excel Discussion (Misc queries) | |||
Cycle through all worksheets | Excel Programming |