Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odd copy and paste question
The logic here sounds so simple to me but I can not get the code to work so I
could use some help. I am in Excel 2000 and I am dealing with 2 sheets in the same workbook. On sheet one I have a column of words (like in Cells A1 to A10) and I need to set up some kind of macro loop that will grab the info from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2 from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a column and pasting it into a row I can not just grab the range. I have to get them one at a time. Here is something a Little better to show what I am talking about Sheet1 | Sheet2 (Cell)A | CellA Cell B Cell C 1 Test | Test Desk House 2 Desk | 3 House | |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odd copy and paste question
Are you simply looking to transpose the data onto sheet2, like so. I have
used sheet1 and sheet2, change to suit Sub TransposeData() Dim wks As Worksheet Set wks = Worksheets("Sheet2") Worksheets("Sheet1").Range("A1:A10").Copy wks.Range("C2").PasteSpecial Transpose:=True End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "ElkySS" wrote in message ... The logic here sounds so simple to me but I can not get the code to work so I could use some help. I am in Excel 2000 and I am dealing with 2 sheets in the same workbook. On sheet one I have a column of words (like in Cells A1 to A10) and I need to set up some kind of macro loop that will grab the info from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2 from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a column and pasting it into a row I can not just grab the range. I have to get them one at a time. Here is something a Little better to show what I am talking about Sheet1 | Sheet2 (Cell)A | CellA Cell B Cell C 1 Test | Test Desk House 2 Desk | 3 House | |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odd copy and paste question
worksheets("Sheet1").Range("A1:A10").copy
Worksheets("Sheet2").Range("C2").PasteSpecial _ Paste:=xlPasteAll, Transpose:=True -- Regards, Tom Ogilvy "ElkySS" wrote in message ... The logic here sounds so simple to me but I can not get the code to work so I could use some help. I am in Excel 2000 and I am dealing with 2 sheets in the same workbook. On sheet one I have a column of words (like in Cells A1 to A10) and I need to set up some kind of macro loop that will grab the info from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2 from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a column and pasting it into a row I can not just grab the range. I have to get them one at a time. Here is something a Little better to show what I am talking about Sheet1 | Sheet2 (Cell)A | CellA Cell B Cell C 1 Test | Test Desk House 2 Desk | 3 House | |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odd copy and paste question
That did exactly what I needed it to do... as soon as I ran it I realized
that there is another part to the exuasion. on Sheet2 every other column is hidded. When it paste the data in from Sheet1 it is even putting it in the hidden cells. Is there a way to make it only write to the visiable cells or to have it step over every other column. I can see columns like C E G I K but it is pasting it in at every cell like C D E F G so it only shows 1/2 of the names. BTW Thanks a lot. I am not sure why that was kicking my butt as much as it was. "Nick Hodge" wrote: Are you simply looking to transpose the data onto sheet2, like so. I have used sheet1 and sheet2, change to suit Sub TransposeData() Dim wks As Worksheet Set wks = Worksheets("Sheet2") Worksheets("Sheet1").Range("A1:A10").Copy wks.Range("C2").PasteSpecial Transpose:=True End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "ElkySS" wrote in message ... The logic here sounds so simple to me but I can not get the code to work so I could use some help. I am in Excel 2000 and I am dealing with 2 sheets in the same workbook. On sheet one I have a column of words (like in Cells A1 to A10) and I need to set up some kind of macro loop that will grab the info from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2 from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a column and pasting it into a row I can not just grab the range. I have to get them one at a time. Here is something a Little better to show what I am talking about Sheet1 | Sheet2 (Cell)A | CellA Cell B Cell C 1 Test | Test Desk House 2 Desk | 3 House | |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odd copy and paste question
Sub abc()
Dim cell As Range For Each cell In Worksheets("Sheet1" _ ).Range("A1:A10") cell.Copy Worksheets("Sheet2").Range( _ "C2").Offset(2, (cell.Row - 1) * 2) Next End Sub -- Regards, Tom Ogilvy "ElkySS" wrote in message ... That did exactly what I needed it to do... as soon as I ran it I realized that there is another part to the exuasion. on Sheet2 every other column is hidded. When it paste the data in from Sheet1 it is even putting it in the hidden cells. Is there a way to make it only write to the visiable cells or to have it step over every other column. I can see columns like C E G I K but it is pasting it in at every cell like C D E F G so it only shows 1/2 of the names. BTW Thanks a lot. I am not sure why that was kicking my butt as much as it was. "Nick Hodge" wrote: Are you simply looking to transpose the data onto sheet2, like so. I have used sheet1 and sheet2, change to suit Sub TransposeData() Dim wks As Worksheet Set wks = Worksheets("Sheet2") Worksheets("Sheet1").Range("A1:A10").Copy wks.Range("C2").PasteSpecial Transpose:=True End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "ElkySS" wrote in message ... The logic here sounds so simple to me but I can not get the code to work so I could use some help. I am in Excel 2000 and I am dealing with 2 sheets in the same workbook. On sheet one I have a column of words (like in Cells A1 to A10) and I need to set up some kind of macro loop that will grab the info from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2 from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a column and pasting it into a row I can not just grab the range. I have to get them one at a time. Here is something a Little better to show what I am talking about Sheet1 | Sheet2 (Cell)A | CellA Cell B Cell C 1 Test | Test Desk House 2 Desk | 3 House | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy and Paste Question | Excel Discussion (Misc queries) | |||
Copy/Paste Question | Excel Discussion (Misc queries) | |||
Copy/Paste question | Excel Worksheet Functions | |||
Tricky copy/paste question | Excel Programming | |||
Copy Paste Question | Excel Discussion (Misc queries) |